getNonTextAttributes = $getNonTextAttributes; $this->attributeCollection = $attributeCollectionFactory->create(); } /** * @inheritdoc */ public function toOptionArray() { $attributes = []; foreach ($this->toArray() as $code => $label) { $attributes[] = ['value' => $code, 'label' => $label]; } return $attributes; } /** * @return array */ public function toArray() { if ($this->fulltextAttributes === null) { $this->fulltextAttributes = []; /** @var \Magento\Eav\Model\Attribute $attribute */ $this->attributeCollection->addIsSearchableFilter() ->setAttributesExcludeFilter($this->getNonTextAttributes->execute()); foreach ($this->attributeCollection as $attribute) { $this->fulltextAttributes[$attribute->getAttributeCode()] = $attribute->getFrontendLabel(); } } return $this->fulltextAttributes; } }