/** * {@inheritdoc} */ public function dump(OutputInterface $output, HelperSet $helperSet) { $output->writeln("<info>Useable field filters...</info>"); $rows = []; foreach ($this->registry->getFieldFilters() as $filter) { $class = get_class($filter); $operators = implode(', ', $filter->getOperators()); foreach ($filter->getFields() as $field) { $rows[] = [$field, $operators, $class]; } } $headers = ['field', 'operators', 'filter_class']; $table = $helperSet->get('table'); $table->setHeaders($headers)->setRows($rows); $table->render($output); }
/** * Returns available information for the attribute and filters which supports it * * @param AttributeInterface $attribute * @param array $attributeFilters * * @return array */ protected function getFilterInformationForAttribute(AttributeInterface $attribute, array $attributeFilters) { $field = $attribute->getCode(); $attributeType = $attribute->getAttributeType(); $isLocalizable = $attribute->isLocalizable() ? 'yes' : 'no'; $isScopable = $attribute->isScopable() ? 'yes' : 'no'; $newEntries = []; if (array_key_exists($attributeType, $attributeFilters)) { foreach ($attributeFilters[$attributeType] as $filter) { $class = get_class($filter); $operators = implode(', ', $filter->getOperators()); $newEntries[] = [$field, $isLocalizable, $isScopable, $attributeType, $operators, $class]; } return $newEntries; } if ($attribute->isBackendTypeReferenceData()) { foreach ($this->registry->getAttributeFilters() as $filter) { if ($filter->supportsAttribute($attribute)) { $class = get_class($filter); $operators = implode(', ', $filter->getOperators()); $newEntries[] = [$field, $isLocalizable, $isScopable, $attributeType, $operators, $class]; } } return $newEntries; } return [[$field, $isLocalizable, $isScopable, $attributeType, '', 'Not supported']]; }