Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Attributes
Filters Class Reference
Inheritance diagram for Filters:
AbstractComponent ObserverInterface DataObject UiComponentInterface BlockInterface

Public Member Functions

 __construct (ContextInterface $context, UiComponentFactory $uiComponentFactory, array $components=[], array $data=[])
 
 getComponentName ()
 
 update (UiComponentInterface $component)
 
 addComponent ($name, UiComponentInterface $component)
 
 getChildComponents ()
 
- Public Member Functions inherited from AbstractComponent
 __construct (ContextInterface $context, array $components=[], array $data=[])
 
 getContext ()
 
 getName ()
 
 prepare ()
 
 toHtml ()
 
 render ()
 
 addComponent ($name, UiComponentInterface $component)
 
 getComponent ($name)
 
 getChildComponents ()
 
 renderChildComponent ($name)
 
 getTemplate ()
 
 getConfiguration ()
 
 getJsConfig (UiComponentInterface $component)
 
 setData ($key, $value=null)
 
 getData ($key='', $index=null)
 
 prepareDataSource (array $dataSource)
 
 getDataSourceData ()
 
- Public Member Functions inherited from DataObject
 __construct (array $data=[])
 
 addData (array $arr)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 getDataByPath ($path)
 
 getDataByKey ($key)
 
 setDataUsingMethod ($key, $args=[])
 
 getDataUsingMethod ($key, $args=null)
 
 hasData ($key='')
 
 toArray (array $keys=[])
 
 convertToArray (array $keys=[])
 
 toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 toJson (array $keys=[])
 
 convertToJson (array $keys=[])
 
 toString ($format='')
 
 __call ($method, $args)
 
 isEmpty ()
 
 serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 
 debug ($data=null, &$objects=[])
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 offsetGet ($offset)
 

Data Fields

const NAME = 'filters'
 

Protected Attributes

 $columnFilters = []
 
 $filterMap
 
 $uiComponentFactory
 
- Protected Attributes inherited from AbstractComponent
 $context
 
 $components
 
 $componentData = []
 
 $dataSources = []
 
- Protected Attributes inherited from DataObject
 $_data = []
 

Additional Inherited Members

- Protected Member Functions inherited from AbstractComponent
 prepareChildComponent (UiComponentInterface $component)
 
 initObservers (array & $data=[])
 
- Protected Member Functions inherited from DataObject
 _getData ($key)
 
 _underscore ($name)
 
- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

@api

Since
100.0.2

Definition at line 18 of file Filters.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( ContextInterface  $context,
UiComponentFactory  $uiComponentFactory,
array  $components = [],
array  $data = [] 
)

@inheritDoc

Definition at line 49 of file Filters.php.

Member Function Documentation

◆ addComponent()

addComponent (   $name,
UiComponentInterface  $component 
)

@inheritDoc

Implements UiComponentInterface.

Definition at line 101 of file Filters.php.

102  {
103  $this->columnFilters[$name] = $component;
104  parent::addComponent($name, $component);
105  }
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ getChildComponents()

getChildComponents ( )

@inheritDoc

Implements UiComponentInterface.

Definition at line 110 of file Filters.php.

111  {
112  $result = parent::getChildComponents();
113  foreach (array_keys($this->columnFilters) as $componentName) {
114  if ($this->getComponent($componentName)) {
115  unset($result[$componentName]);
116  }
117  }
118 
119  return $result;
120  }

◆ getComponentName()

getComponentName ( )

Get component name

Returns
string

Implements UiComponentInterface.

Definition at line 64 of file Filters.php.

65  {
66  return static::NAME;
67  }

◆ update()

update ( UiComponentInterface  $component)

@inheritDoc

Implements ObserverInterface.

Definition at line 72 of file Filters.php.

73  {
74  if ($component instanceof ColumnInterface) {
75  $filterType = $component->getData('config/filter');
76 
77  if (is_array($filterType)) {
78  $filterType = $filterType['filterType'];
79  }
80 
81  if (!$filterType) {
82  return;
83  }
84 
85  if (isset($this->filterMap[$filterType]) && !isset($this->columnFilters[$component->getName()])) {
86  $filterComponent = $this->uiComponentFactory->create(
87  $component->getName(),
88  $this->filterMap[$filterType],
89  ['context' => $this->getContext()]
90  );
91  $filterComponent->setData('config', $component->getConfiguration());
92  $filterComponent->prepare();
93  $this->addComponent($component->getName(), $filterComponent);
94  }
95  }
96  }
addComponent($name, UiComponentInterface $component)
Definition: Filters.php:101

Field Documentation

◆ $columnFilters

$columnFilters = []
protected

Definition at line 27 of file Filters.php.

◆ $filterMap

$filterMap
protected
Initial value:
= [
'text' => 'filterInput',
'textRange' => 'filterRange',
'select' => 'filterSelect',
'dateRange' => 'filterDate',
]

Definition at line 34 of file Filters.php.

◆ $uiComponentFactory

$uiComponentFactory
protected

Definition at line 44 of file Filters.php.

◆ NAME

const NAME = 'filters'

Definition at line 20 of file Filters.php.


The documentation for this class was generated from the following file: