Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
README.md 2.18 KiB
Newer Older
  • Learn to ignore specific revisions
  • Nicolas's avatar
    Nicolas committed
    
    # CATEGORY WIDGET
    
    Permet d'afficher une catégorie ou une liste de catégories avec leur image.
    
    ## Variables
    
    - widget_title (setWidgetTitle) : Optionnel : Titre H2 du widget
    - widget_content (setWidgetContent) : Optionnel : Contenu texte servant à insérer une description dans le widget
    - category_selection (setCategorySelection): Obligatoire : ID de la catégorie à afficher. Pour en afficher plusieurs 3,6
    
    - category_image_width (setCategoryImageWidth) : Optionnel : Définit la largeur en pixels pour la compression de l'image, par défaut 450px
    - category_image_height (setCategoryImageHeight) : Optionnel : Définit la hateur en pixels pour la compression de l'image, par défaut 450px
    
    Nicolas's avatar
    Nicolas committed
    - template (setTemplate) : Obligatoire : Permet de sélectionner le template de rendu
    
    Nicolas's avatar
    Nicolas committed
    
    ## Exemples d'intégration
    
    Dans un fichier layout (XML) :
    ```xml
    <block class="NicolasBejean\CategoryWidget\Block\Widget\CategoryWidget">
        <arguments>
    
            <argument name="category_selection" xsi:type="string">4,5,6,7</argument>
            <argument name="category_image_width" xsi:type="string">450</argument>
            <argument name="category_image_height" xsi:type="string">450</argument>
    
    Nicolas's avatar
    Nicolas committed
            <argument name="template" xsi:type="string">widget/category_widget_img_background.phtml</argument>
    
    Nicolas's avatar
    Nicolas committed
        </arguments>
    </block>
    ```
    
    Dans un fichier de template (PHTML) :
    ```php
    <?php
    echo $this  ->getLayout()
                ->createBlock("NicolasBejean\CategoryWidget\Block\Widget\CategoryWidget")
    
                ->setCategorySelection("4,5,6,7")
                ->setCategoryImageWidth("450")
                ->setCategoryImageHeight("450")
                ->setTemplate("widget/category_widget_img_background.phtml")
    
    Nicolas's avatar
    Nicolas committed
                ->toHtml();
    ?>
    ```
    Dans le backoffice :
    ```html
    
    {{widget type="NicolasBejean\CategoryWidget\Block\Widget\CategoryWidget" widget_title="titre" widget_content="tag" category_selection="3" category_image_width="450" category_image_height="450" template="widget/category_widget_img_background.phtml"}}
    
    Nicolas's avatar
    Nicolas committed
    ```
    
    Nicolas's avatar
    Nicolas committed
    ## Source
    
    
    Nicolas BEJEAN's avatar
    Nicolas BEJEAN committed
    https://github.com/Programmingatkstark/Magento-2-Category-with-image-widget
    
    ## TODO
    
    Problème au hover sur le template img_background
    Ajouter la sélection de H1... dans le titre du widget (Reprendre Media Manager)