diff -r 98a84761634f -r 7e69ecc9fd43 src/source/dev_guide/howto-paragraph.rst --- a/src/source/dev_guide/howto-paragraph.rst Fri Dec 14 12:16:12 2018 +0100 +++ b/src/source/dev_guide/howto-paragraph.rst Mon Dec 17 17:19:35 2018 +0100 @@ -100,31 +100,16 @@ Paragraph in the ZMI """""""""""""""""""" - -To display and manage the new paragraph in the ZMI, you should create this associated forms +1) Container Paragraph +---------------------- -1) Paragraph factory --------------------- +For example :py:class:`IParagraphContainerTarget`, it's a marker interface for paragraph containers. To create a new element instance inside the zodb, we need a container to this object. PyAMS provide -`IParagraphContainerTarget`, it's the default container for all paragraphs. We could use this container interface -as context to create a new paragraph. - - -Declaration of the **factory** of `ContactPhoneParagraph` - -.. code-block:: python +`IParagraphContainerTarget`, it's the default marker interface container for all paragraphs. +We could use this interface as context to declare a new pagelet. - @utility_config(name=CONTACT_PHONE_PARAGRAPH_TYPE, provides=IParagraphFactory) - class ContactPhoneParagraphFactory(BaseParagraphFactory): - """Contact paragraph factory""" - - name = _("Contact Phone card") - content_type = ContactPhoneParagraph - secondary_menu = True - - -Definition of a form to create a new ContactPhone instance +Definition of a Contact Phone form to create a new ContactPhone object .. code-block:: python @@ -152,6 +137,8 @@ IParagraphContainer(self.context).append(object) +To display and manage the new paragraph in the ZMI, you should create this associated forms + 2) Create the Paragraph addform button in the menu -------------------------------------------------- @@ -209,7 +196,7 @@ 4) Create an Edit modal form ------------------------------ +---------------------------- This form is used inside modals popup @@ -241,6 +228,27 @@ .. image:: ../_static/select_paragraph.png +5) Paragraph Factory +-------------------- + +If you want to create automatically a paragraph object for a shared content you must define a factory + +Declaration of the **factory** of `ContactPhoneParagraph` + +.. code-block:: python + + @utility_config(name=CONTACT_PHONE_PARAGRAPH_TYPE, provides=IParagraphFactory) + class ContactPhoneParagraphFactory(BaseParagraphFactory): + """Contact paragraph factory""" + + name = _("Contact Phone card") + content_type = ContactPhoneParagraph + secondary_menu = True + +When the contributors will create new shared content with predefined paragraphs, +it's the container factory class that will be used to create the paragraph object. + + How to associate links or Illustrations to a Paragraph ? ========================================================