Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ProductAttributeGridBuildObserver.php
Go to the documentation of this file.
1 <?php
9 
12 
14 {
18  protected $moduleManager;
19 
24  {
25  $this->moduleManager = $moduleManager;
26  }
27 
32  public function execute(\Magento\Framework\Event\Observer $observer)
33  {
34  if (!$this->moduleManager->isOutputEnabled('Magento_LayeredNavigation')) {
35  return;
36  }
37 
39  $grid = $observer->getGrid();
40 
41  $grid->addColumnAfter(
42  'is_filterable',
43  [
44  'header' => __('Use in Layered Navigation'),
45  'sortable' => true,
46  'index' => 'is_filterable',
47  'type' => 'options',
48  'options' => [
49  '1' => __('Filterable (with results)'),
50  '2' => __('Filterable (no results)'),
51  '0' => __('No'),
52  ],
53  'align' => 'center',
54  ],
55  'is_searchable'
56  );
57  }
58 }
__()
Definition: __.php:13