Advanced Content Manager for Magento 2

Layout Update XML

Overview

If you wish to prepend or append text to your list and wish to translate your list, we suggest to create a dedicated content type. e.g: “List of news”, composed with a wysiwyg editor and the following layout xml. Otherwise, you can simply use a CMS → Pages and use the following layout xml in the corresponding textarea.

Information:

  • setTitle($title) -> $title: title of the ContentList

  • setCtType($identifier) $identifier: identifier of the ContentType

  • setCtId($id) $id: id of the ContentType

  • setPager($enable) $enable: boolean

  • setPagerPosition($position) $position: 0 (top), 1 (bottom), 2 (top & bottom)

  • setLimitPerPage($limit) $limit: integer

  • setLimitDisplay($limit) $limit: integer

  • setOrderField($order) $order: id of the attribute

  • setSortOrder($order) $order: ASC or DESC


  • addAttributeToShow($attribute, $params)

    • $attribute: identifiant de l’attribut

    • $params: tableau de paramètres, voir les clés suivantes:

      • label: 0 (hide label) 1 (show above) 2 (show belove) 3 (show inline)

      • label_type: tag html de l’élément

      • html_label_tag: tag html du label de l’élément

      • html_tag: tag html du conteneur de l’élément

      • html_id: id html du conteneur de l’élément

      • html_class: classe(s) html du conteneur de l’élément

      • has_link: boolean, définit si l’élément est transformé en lien cliquable

Only for ‘file’ type:

  • type: file_filename_without (nom du fichier sans l’extension) file_filename_with (nom du fichier avec l’extension) file_custom_label (label personnalisé)

  • extra: si type vaut file_custom_label: label pour le fichier

Only for ‘image’ type:

  • type: image_cropped (image cropé) image_original (image originale)

  • width: nombre entier (largeur de l’image)

  • height: nombre entier (hauteur de l’image)

  • link: boolean (liens vers l’image originale)

Only for ‘date’ type:

  • type: date_short (date courte) date_medium (date standarde) date_long (date complète)

Only for ‘datetime’ type:

  • type: date_time_short (date courte) date_time_medium (date standarde) date_time_long (date complète)

Only for ‘product’ type:

  • type: product_name (nom du produit) product_name_image (image et nom du produit) product_name_price (nom et prix du produit) product_name_image_price (nom, image et prix du produit) product_all (affichage du produit comme dans le thème)

Only for ‘category’ type:

  • type: category_name (affiche le nom de la catégorie)

Only for ‘content’ type:

  • type: content_name_linked (affiche le titre avec lien des contents) content_name (affiche le titre des contents)

Only for ‘attribute’ type:

  • type: attribute_list_values (affiche la valeur des attributs sous forme de liste) attribute_list_titles (affiche le titre des attributs sous forme de liste) attribute_comma_values (affiche la valeur des attributs à la suite) attribute_comma_titles (affiche le titre des attributs à la suite)

Only for ‘checkbox’ type:

  • type: checkbox_list_values (affiche les valeurs sous forme de liste) checkbox_list_titles (affiche les titres sous forme de liste) checkbox_comma_values (affiche les valeurs à la suite) checkbox_comma_titles (affiche les titres à la suite)

Only for ‘multiple’ type:

  • type: multiple_list_values (affiche les valeurs sous forme de liste) multiple_list_titles (affiche les titre sous forme de liste) multiple_comma_values (affiche les valeurs à la suite) multiple_comma_titles (affiche les titre à la suite)

Only for ‘radio’ type:

  • type: radio_select_value (affiche la valeur) radio_select_title (affiche le titre)

Only for ‘drop_down’ type:

  • type: drop_select_value (affiche la valeur) drop_select_title (affiche le titre)


  • addAttributeToFilter($attribute, $condition, $value)

    • $attribute: identifiant de l’attribut

    • $condition: opérateur de comparaison mathématique

    • $value: valeur à comparer

addLink($label, $position) $label: intitulé $position: top ou bottom

Example

  <referenceContainer name="content">
   <block class="Blackbird\ContentManager\Block\Content\Widget\ContentList" name="content_type_identifier_list" >
   <action method="setTitle">
   <argument name="title" xsi:type="string">My Title</argument>
   </action>
   <action method="setCtType">
   <argument name="type" xsi:type="string">content_type_identifier</argument>
   </action>
   <action method="setPager">
   <argument name="pager" xsi:type="boolean">true</argument>
   </action>
   <action method="setPagerPosition">
   <argument name="pager" xsi:type="string">1</argument>
   </action>
   <action method="setLimitPerPage">
   <argument name="limit_per_page" xsi:type="string">5</argument>
   </action>
   <action method="setLimitDisplay">
   <argument name="limit_display" xsi:type="string">10</argument>
   </action>
   <action method="setOrderField">
   <argument name="order_field" xsi:type="string">attribute_code</argument>
   </action>
   <action method="setSortOrder">
   <argument name="sort_order" xsi:type="string">ASC</argument>
   </action>
   <action method="addAttributeToShow">
   <argument name="attribute" xsi:type="string">title</argument>
   <argument name="params" xsi:type="array">
   <item name="has_link" xsi:type="string">1</item>
   </argument>
   </action>
   <action method="addAttributeToShow">
   <argument name="attribute" xsi:type="string">description</argument>
   </action> 
   <action method="addAttributeToShow">
   <argument name="attribute" xsi:type="string">image</argument>
   <argument name="params" xsi:type="array">
   <item name="width" xsi:type="string">100</item>
   <item name="height" xsi:type="string">100</item>
   <item name="has_link" xsi:type="string">1</item>
   </argument>
   </action>
   
   <action method="addAttributeToFilter">
   <argument name="attribute" xsi:type="string">promote</argument>
   <argument name="condition" xsi:type="string">eq</argument>
   
   <argument name="value" xsi:type="string">1</argument>
   </action>
   <action method="addLink">
   <argument name="label" xsi:type="string">Read more</argument>
   <argument name="position" xsi:type="string">bottom</argument>
   </action>
   </block>
  </referenceContainer>