Smile-SA/elasticsuite

View on GitHub
src/module-elasticsuite-thesaurus/view/adminhtml/layout/smile_elasticsuite_thesaurus_grid_block.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0"?>
<!--
/**
 * Thesaurus grid layout
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
 * versions in the future.
 *
 * @category  Smile
 * @package   Smile\ElasticsuiteThesaurus
 * @author    Romain RUAUD <romain.ruaud@smile.fr>
 * @copyright 2020 Smile
 * @license   Open Software License ("OSL") v. 3.0
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="adminhtml.elasticsuite.thesaurus.grid.container">
            <block class="Smile\ElasticsuiteThesaurus\Block\Adminhtml\Thesaurus\Grid" name="adminhtml.elasticsuite.thesaurus.grid" as="grid">
                <arguments>
                    <argument name="id" xsi:type="string">smile_elasticsuite_thesaurus_grid</argument>
                    <argument name="dataSource" xsi:type="object">Smile\ElasticsuiteThesaurus\Model\ResourceModel\Thesaurus\Collection</argument>
                    <argument name="default_sort" xsi:type="string">name</argument>
                    <argument name="default_dir" xsi:type="string">ASC</argument>
                    <argument name="save_parameters_in_session" xsi:type="string">1</argument>
                </arguments>

                <block class="Magento\Backend\Block\Widget\Grid\Export" name="adminhtml.elasticsuite.thesaurus.grid.export" as="grid.export">
                    <arguments>
                        <argument name="exportTypes" xsi:type="array">
                            <item name="csv" xsi:type="array">
                                <item name="urlPath" xsi:type="string">*/*/exportCsv</item>
                                <item name="label" xsi:type="string" translate="true">CSV</item>
                            </item>
                        </argument>
                    </arguments>
                </block>

                <block class="Magento\Backend\Block\Widget\Grid\Massaction" name="adminhtml.elasticsuite.thesaurus.grid.massaction" as="grid.massaction">
                    <arguments>
                        <argument name="massaction_id_field" xsi:type="string">thesaurus_id</argument>
                        <argument name="form_field_name" xsi:type="string">thesauri</argument>
                        <argument name="use_select_all" xsi:type="string">1</argument>
                        <argument name="options" xsi:type="array">
                            <item name="enable" xsi:type="array">
                                <item name="label" xsi:type="string" translate="true">Enable</item>
                                <item name="url" xsi:type="string">*/*/massEnable</item>
                                <item name="confirm" xsi:type="string" translate="true">Are you sure you want to enable the selected thesaurus?</item>
                            </item>
                            <item name="disable" xsi:type="array">
                                <item name="label" xsi:type="string" translate="true">Disable</item>
                                <item name="url" xsi:type="string">*/*/massDisable</item>
                                <item name="confirm" xsi:type="string" translate="true">Are you sure you want to disable the selected thesaurus?</item>
                            </item>
                            <item name="delete" xsi:type="array">
                                <item name="label" xsi:type="string" translate="true">Delete</item>
                                <item name="url" xsi:type="string">*/*/massDelete</item>
                                <item name="confirm" xsi:type="string" translate="true">Are you sure you want to delete the selected thesaurus?</item>
                            </item>
                        </argument>
                    </arguments>
                </block>

                <block class="Magento\Backend\Block\Widget\Grid\ColumnSet" name="adminhtml.elasticsuite.thesaurus.grid.columnSet" as="grid.columnSet">
                    <arguments>
                        <argument name="rowUrl" xsi:type="array">
                            <item name="path" xsi:type="string">*/*/edit</item>
                            <item name="extraParamsTemplate" xsi:type="array">
                                <item name="thesaurus_id" xsi:type="string">getId</item>
                            </item>
                        </argument>
                    </arguments>
                    <block class="Magento\Backend\Block\Widget\Grid\Column" as="thesaurus_name">
                        <arguments>
                            <argument name="header" xsi:type="string" translate="true">Name</argument>
                            <argument name="index" xsi:type="string">name</argument>
                        </arguments>
                    </block>
                    <block class="Magento\Backend\Block\Widget\Grid\Column" as="thesaurus_type">
                        <arguments>
                            <argument name="header" xsi:type="string" translate="true">Type</argument>
                            <argument name="index" xsi:type="string">type</argument>
                            <argument name="type" xsi:type="string">options</argument>
                            <argument name="options" xsi:type="array">
                                <item name="expansion" xsi:type="array">
                                    <item name="value" xsi:type="string">expansion</item>
                                    <item name="label" xsi:type="string" translate="true">Expansions</item>
                                </item>
                                <item name="synonym" xsi:type="array">
                                    <item name="value" xsi:type="string">synonym</item>
                                    <item name="label" xsi:type="string" translate="true">Synonyms</item>
                                </item>
                            </argument>
                        </arguments>
                    </block>
                    <block class="Magento\Backend\Block\Widget\Grid\Column" as="thesaurus_terms_summary">
                        <arguments>
                            <argument name="type" xsi:type="string">text</argument>
                            <argument name="sortable" xsi:type="boolean">false</argument>
                            <argument name="header" xsi:type="string" translate="true">Terms</argument>
                            <argument name="index" xsi:type="string">terms_summary</argument>
                            <argument name="escape" xsi:type="string">0</argument>
                            <argument name="nl2br" xsi:type="string">1</argument>
                        </arguments>
                    </block>
                    <block class="Magento\Backend\Block\Widget\Grid\Column\Multistore" as="store_id">
                        <arguments>
                            <argument name="header" xsi:type="string" translate="true">Store</argument>
                            <argument name="type" xsi:type="string">store</argument>
                            <argument name="id" xsi:type="string">store_ids</argument>
                            <argument name="index" xsi:type="string">store_ids</argument>
                            <argument name="store_view" xsi:type="string">1</argument>
                            <argument name="sortable" xsi:type="string">0</argument>
                        </arguments>
                    </block>
                    <block class="Magento\Backend\Block\Widget\Grid\Column" as="thesaurus_is_active">
                        <arguments>
                            <argument name="header" xsi:type="string" translate="true">Status</argument>
                            <argument name="index" xsi:type="string">is_active</argument>
                            <argument name="type" xsi:type="string">options</argument>
                            <argument name="options" xsi:type="array">
                                <item name="expansion" xsi:type="array">
                                    <item name="value" xsi:type="string">0</item>
                                    <item name="label" xsi:type="string" translate="true">Inactive</item>
                                </item>
                                <item name="synonym" xsi:type="array">
                                    <item name="value" xsi:type="string">1</item>
                                    <item name="label" xsi:type="string" translate="true">Active</item>
                                </item>
                            </argument>
                        </arguments>
                    </block>
                    <block class="Magento\Backend\Block\Widget\Grid\Column" as="action">
                        <arguments>
                            <argument name="type" xsi:type="string">action</argument>
                            <argument name="header" xsi:type="string" translate="true">Action</argument>
                            <argument name="filter" xsi:type="string">0</argument>
                            <argument name="sortable" xsi:type="string">0</argument>
                            <argument name="index" xsi:type="string">thesaurus_id</argument>
                            <argument name="actions" xsi:type="array">
                                <item name="edit" xsi:type="array">
                                    <item name="caption" xsi:type="string" translate="true">Edit</item>
                                    <item name="url" xsi:type="array">
                                        <item name="base" xsi:type="string">*/*/edit</item>
                                    </item>
                                    <item name="field" xsi:type="string">thesaurus_id</item>
                                </item>
                                <item name="delete" xsi:type="array">
                                    <item name="caption" xsi:type="string" translate="true">Delete</item>
                                    <item name="url" xsi:type="array">
                                        <item name="base" xsi:type="string">*/*/delete</item>
                                    </item>
                                    <item name="confirm" xsi:type="string" translate="true">Are you sure?</item>
                                    <item name="field" xsi:type="string">thesaurus_id</item>
                                </item>
                            </argument>
                        </arguments>
                    </block>
                </block>
            </block>
        </referenceBlock>
    </body>
</page>