Smile\ElasticsuiteCatalog\Model\Eav\Indexer\Fulltext\Datasource\AbstractAttributeData::initField PHP Method

initField() private method

Create a mapping field from an attribute.
private initField ( Magento\Eav\Model\Entity\Attribute\AttributeInterface $attribute ) : AbstractAttributeData
$attribute Magento\Eav\Model\Entity\Attribute\AttributeInterface Entity attribute.
return AbstractAttributeData
    private function initField(AttributeInterface $attribute)
    {
        $fieldName = $attribute->getAttributeCode();
        $fieldConfig = $this->attributeHelper->getMappingFieldOptions($attribute);
        if ($attribute->usesSource()) {
            $optionFieldName = $this->attributeHelper->getOptionTextFieldName($fieldName);
            $fieldType = 'string';
            $fieldOptions = ['name' => $optionFieldName, 'type' => $fieldType, 'fieldConfig' => $fieldConfig];
            $this->fields[$optionFieldName] = $this->fieldFactory->create($fieldOptions);
            // Reset parent field values : only the option text field should be used for spellcheck and autocomplete.
            $fieldConfig['is_used_in_spellcheck'] = false;
            $fieldConfig['is_used_in_autocomplete'] = false;
            $fieldConfig['is_searchable'] = false;
        }
        $fieldType = $this->attributeHelper->getFieldType($attribute);
        $fieldOptions = ['name' => $fieldName, 'type' => $fieldType, 'fieldConfig' => $fieldConfig];
        $this->fields[$fieldName] = $this->fieldFactory->create($fieldOptions);
        return $this;
    }