Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
KeywordType.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
13 
18 {
22  private $fieldTypeConverter;
23 
27  public function __construct(ConverterInterface $fieldTypeConverter)
28  {
29  $this->fieldTypeConverter = $fieldTypeConverter;
30  }
31 
38  public function getFieldType(AttributeAdapter $attribute): ?string
39  {
40  if ($attribute->isComplexType()
41  || (!$attribute->isSearchable() && !$attribute->isAlwaysIndexable() && $attribute->isFilterable())
42  ) {
43  return $this->fieldTypeConverter->convert(ConverterInterface::INTERNAL_DATA_TYPE_KEYWORD);
44  }
45 
46  return null;
47  }
48 }