Exemplo n.º 1
0
 /**
  * @param \Magento\Catalog\Api\Data\ProductAttributeInterface $attribute
  * @param \Magento\Framework\View\Element\UiComponent\ContextInterface $context
  * @param array $config
  * @return \Magento\Ui\Component\Listing\Columns\ColumnInterface
  */
 public function create($attribute, $context, $config = [])
 {
     $columnName = $attribute->getAttributeCode();
     $config = array_merge(['dataScope' => $columnName, 'label' => __($attribute->getDefaultFrontendLabel())], $config);
     if ($attribute->usesSource() && $attribute->getSourceModel()) {
         $config['options'] = $attribute->getSource()->getAllOptions();
         $config['caption'] = __('Select...');
     }
     $arguments = ['data' => ['config' => $config], 'context' => $context];
     return $this->componentFactory->create($columnName, $this->getFilterType($attribute), $arguments);
 }