Smile-SA/elasticsuite

View on GitHub
src/module-elasticsuite-virtual-category/etc/frontend/di.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0"?>
<!--
/**
 * Smile_ElasticsuiteVirtualCategory frontend DI.
 *
 * 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\ElasticsuiteVirtualCategory
 * @author    Aurelien FOUCRET <aurelien.foucret@smile.fr>
 * @copyright 2020 Smile
 * @license   Open Software License ("OSL") v. 3.0
 */
 -->

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

    <virtualType name="categoryFilterUsingRewrite" type="Smile\ElasticsuiteVirtualCategory\Model\Layer\Filter\Category">
        <arguments>
            <argument name="useUrlRewrites" xsi:type="boolean">true</argument>
        </arguments>
    </virtualType>

    <virtualType name="searchFilterList" type="Smile\ElasticsuiteCatalog\Model\Layer\FilterList">
        <arguments>
            <argument name="filters" xsi:type="array">
                <item name="category" xsi:type="string">Smile\ElasticsuiteVirtualCategory\Model\Layer\Filter\Category</item>
            </argument>
        </arguments>
    </virtualType>

    <type name="Magento\Catalog\Model\ResourceModel\Category\Flat">
        <plugin name="smile_elasticsuite_virtual_categories_flat"
                type="Smile\ElasticsuiteVirtualCategory\Plugin\Catalog\Category\FlatPlugin" />
    </type>
    <type name="Magento\Catalog\Model\Product">
        <plugin name="smile_elasticsuite_virtual_categories_product"
                type="Smile\ElasticsuiteVirtualCategory\Plugin\Catalog\Product\ProductPlugin"/>
    </type>

    <type name="Magento\Framework\App\RouterList">
        <arguments>
            <argument name="routerList" xsi:type="array">
                <item name="smile_elasticsuite_virtualcategory" xsi:type="array">
                    <item name="class" xsi:type="string">Smile\ElasticsuiteVirtualCategory\Controller\Router</item>
                    <item name="disable" xsi:type="boolean">false</item>
                    <item name="sortOrder" xsi:type="string">50</item>
                </item>
            </argument>
        </arguments>
    </type>

    <type name="Magento\Catalog\Model\Product">
        <plugin name="smile_elasticsuite_virtual_categories_product"
                type="Smile\ElasticsuiteVirtualCategory\Plugin\Catalog\ProductPlugin" />
    </type>

    <virtualType name="Smile\ElasticsuiteVirtualCategory\Model\Layer\Filter\DataProvider\CategoryFactory"
                 type="Magento\Catalog\Model\Layer\Filter\DataProvider\CategoryFactory">
        <arguments>
            <argument name="instanceName" xsi:type="string">Smile\ElasticsuiteVirtualCategory\Model\Layer\Filter\DataProvider\Category</argument>
        </arguments>
    </virtualType>

    <type name="Smile\ElasticsuiteVirtualCategory\Model\Layer\Filter\Category">
        <arguments>
            <argument name="dataProviderFactory" xsi:type="object">Smile\ElasticsuiteVirtualCategory\Model\Layer\Filter\DataProvider\CategoryFactory</argument>
        </arguments>
    </type>

    <type name="Magento\Catalog\Helper\Data">
        <plugin name="smile_elasticsuite_virtual_categories_breadcrumb"
                type="Smile\ElasticsuiteVirtualCategory\Plugin\Catalog\Helper\BreadcrumbPlugin" />
    </type>

    <type name="Magento\Catalog\Model\Design">
        <plugin name="smile_elasticsuite_virtual_categories_design"
                type="Smile\ElasticsuiteVirtualCategory\Plugin\Catalog\DesignPlugin" />
    </type>
</config>