Current path: home/webdevt/prestashop17/src/Core/Grid/Definition/Factory/Monitoring/
?? Go up: /home/webdevt/prestashop17/src/Core/Grid/Definition/Factory
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
namespace PrestaShop\PrestaShop\Core\Grid\Definition\Factory\Monitoring;
use PrestaShop\PrestaShop\Core\Grid\Column\ColumnCollection;
use PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\ActionColumn;
use PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\BulkActionColumn;
use PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\IdentifierColumn;
use PrestaShop\PrestaShop\Core\Grid\Column\Type\DataColumn;
use PrestaShop\PrestaShop\Core\Grid\Filter\Filter;
use PrestaShop\PrestaShop\Core\Grid\Filter\FilterCollection;
use PrestaShopBundle\Form\Admin\Type\SearchAndResetType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
/**
* Builds Grid definition for disabled product grid
*/
final class DisabledProductGridDefinitionFactory extends AbstractProductGridDefinitionFactory
{
public const GRID_ID = 'disabled_product';
/**
* {@inheritdoc}
*/
protected function getName()
{
return $this->trans('List of disabled products', [], 'Admin.Catalog.Feature');
}
/**
* {@inheritdoc}
*/
protected function getColumns()
{
return (new ColumnCollection())
->add(
(new BulkActionColumn('monitoring_products_bulk'))
->setOptions([
'bulk_field' => 'id_product',
])
)
->add(
(new IdentifierColumn('id_product'))
->setName($this->trans('ID', [], 'Admin.Global'))
->setOptions([
'identifier_field' => 'id_product',
])
)
->add(
(new DataColumn('reference'))
->setName($this->trans('Reference', [], 'Admin.Global'))
->setOptions([
'field' => 'reference',
])
)
->add(
(new DataColumn('name'))
->setName($this->trans('Name', [], 'Admin.Global'))
->setOptions([
'field' => 'name',
])
)
->add(
(new ActionColumn('actions'))
->setName($this->trans('Actions', [], 'Admin.Global'))
->setOptions([
'actions' => $this->getRowActions(),
])
);
}
/**
* {@inheritdoc}
*/
protected function getFilters()
{
return (new FilterCollection())
->add(
(new Filter('id_product', TextType::class))
->setAssociatedColumn('id_product')
->setTypeOptions([
'required' => false,
'attr' => [
'placeholder' => $this->trans('Search ID', [], 'Admin.Actions'),
],
])
)
->add(
(new Filter('reference', TextType::class))
->setAssociatedColumn('reference')
->setTypeOptions([
'required' => false,
'attr' => [
'placeholder' => $this->trans('Search reference', [], 'Admin.Actions'),
],
])
)
->add(
(new Filter('name', TextType::class))
->setAssociatedColumn('name')
->setTypeOptions([
'required' => false,
'attr' => [
'placeholder' => $this->trans('Search name', [], 'Admin.Actions'),
],
])
)
->add(
(new Filter('actions', SearchAndResetType::class))
->setAssociatedColumn('actions')
->setTypeOptions([
'reset_route' => 'admin_common_reset_search_by_filter_id',
'reset_route_params' => [
'filterId' => $this::GRID_ID,
],
'redirect_route' => 'admin_monitorings_index',
])
->setAssociatedColumn('actions')
);
}
}