@@ -128,7 +128,7 @@ Understanding the Code
128128Component Declaration
129129^^^^^^^^^^^^^^^^^^^^^
130130
131- ::
131+ .. code-block :: django
132132
133133 {% cms_component "Hero" name=_("My Hero Component") %}
134134
@@ -139,10 +139,36 @@ class. All named arguments are added to the component's Meta class.
139139
140140Only one ``{% cms_component %} `` tag is allowed per template file.
141141
142+ The first part is the declarative part of the template:
143+
144+ .. code-block: django
145+ {% cms_component "Hero" name=_("My Hero Component") %}
146+ {% field "title" forms.CharField required=True name=_("Title") %}
147+ {% field "slogan" forms.CharField required=True name=_("Slogan") widget=forms.Textarea %}
148+ {% field "hero_image" ImageFormField required=True name=_("Image") help_text=_("At least 1024px wide image") %}
149+
150+ It will render empty. During project startup, however, these tags are evaluated and used to create the ``CMSFrontendComponent `` class
151+ and the corresponding plugins class.
152+
153+ The named parameters are added to the ``CMSFrontendComponent ``'s Meta class and end up as properties of the plugin itself. The
154+ following attributes are allowed:
155+
156+ * ``name ``: The name of the component as it will be displayed in the CMS admin interface.
157+ * ``module ``: The module the component belongs to. This is used to group components in the CMS admin interface.
158+ * ``disable_edit ``: If set to ``True ``, the component will not be editable in the frontend.
159+ * ``show_add_form ``: If set to ``False ``, the component will not show an add form in the frontend. This is useful if
160+ all component fields have valid initial values.
161+ * ``require_parent ``: If set to ``True ``, the component will only be available if it is a child of another component.
162+ * ``parent_classes ``: A list of plugin classes that can be parents of this component.
163+ * ``child_classes ``: A list of plugin classes that can be children of this component.
164+
165+ ``allow_children `` and ``frontend_editable_fields `` are set automatically.
166+
167+
142168Defining Fields
143169^^^^^^^^^^^^^^^
144170
145- ::
171+ .. code-block :: django
146172
147173 {% field "title" forms.CharField required=True name=_("Title") %}
148174 {% field "slogan" forms.CharField required=True name=_("Slogan") widget=forms.Textarea %}
@@ -154,7 +180,7 @@ form field class to use. The remaining parameters are passed to the form field c
154180
155181By default, Django's ``django.forms `` module is available as ``forms `` in the template context. If the relevant apps are
156182installed, additional fields available are ``HTMLFormField `` for rich text, ``LinkFormField `` for links, and ``ImageFormField ``
157- for images. Custom fields can be added to the context using the :ref: ` CMS_FRONTEND_CUSTOM_FIELDS ` setting.
183+ for images. Custom fields can be added to the context using the :attr: ` ~settings.DJANGOCMS_FRONTEND_COMPONENT_FIELDS ` setting.
158184
159185You can add additional fields to the component by adding more ``{% field %} `` tags.
160186
@@ -198,7 +224,7 @@ Adding inline-editing to the component
198224--------------------------------------
199225
200226When using `djangocms-text <https://github.com/django-cms/djangocms-text >`_, fields of the component can be
201- marked as inline fields to activate inline editing. Simply replace ``{{ title }}``and/or ``{{ slogan }} `` with
227+ marked as inline fields to activate inline editing. Simply replace ``{{ title }} `` and/or ``{{ slogan }} `` with
202228``{% inline_field "title" %} `` and/or ``{% inline_field "slogan" %} ``::
203229
204230 <h1>{% inline_field "title" %}</h1>
0 commit comments