Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes | Static Protected Attributes
Attribute Class Reference
Inheritance diagram for Attribute:
Attribute ProductAttributeInterface ScopedAttributeInterface AbstractAttribute IdentityInterface EavAttributeInterface AbstractExtensibleModel AttributeInterface AttributeInterface AttributeInterface AbstractModel CustomAttributesDataInterface CustomAttributesDataInterface MetadataObjectInterface CustomAttributesDataInterface MetadataObjectInterface DataObject ExtensibleDataInterface ExtensibleDataInterface ExtensibleDataInterface

Public Member Functions

 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Eav\Api\Data\AttributeOptionInterfaceFactory $optionDataFactory, \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Catalog\Model\Product\ReservedAttributeList $reservedAttributeList, \Magento\Framework\Locale\ResolverInterface $localeResolver, DateTimeFormatterInterface $dateTimeFormatter, \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor, \Magento\Catalog\Model\Indexer\Product\Eav\Processor $indexerEavProcessor, \Magento\Catalog\Helper\Product\Flat\Indexer $productFlatIndexerHelper, LockValidatorInterface $lockValidator, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[], \Magento\Eav\Api\Data\AttributeExtensionFactory $eavAttributeFactory=null)
 
 beforeSave ()
 
 afterSave ()
 
 isEnabledInFlat ()
 
 beforeDelete ()
 
 afterDeleteCommit ()
 
 getIsGlobal ()
 
 isScopeGlobal ()
 
 isScopeWebsite ()
 
 isScopeStore ()
 
 getStoreId ()
 
 getApplyTo ()
 
 getSourceModel ()
 
 isAllowedForRuleCondition ()
 
 _getDefaultSourceModel ()
 
 isIndexable ()
 
 getIndexType ()
 
 getIsWysiwygEnabled ()
 
 getIsHtmlAllowedOnFront ()
 
 getUsedForSortBy ()
 
 getIsFilterable ()
 
 getIsFilterableInSearch ()
 
 getIsUsedInGrid ()
 
 getIsVisibleInGrid ()
 
 getIsFilterableInGrid ()
 
 getPosition ()
 
 getIsSearchable ()
 
 getIsVisibleInAdvancedSearch ()
 
 getIsComparable ()
 
 getIsUsedForPromoRules ()
 
 getIsVisibleOnFront ()
 
 getUsedInProductListing ()
 
 getIsVisible ()
 
 getScope ()
 
 setIsWysiwygEnabled ($isWysiwygEnabled)
 
 setIsHtmlAllowedOnFront ($isHtmlAllowedOnFront)
 
 setUsedForSortBy ($usedForSortBy)
 
 setIsFilterable ($isFilterable)
 
 setIsFilterableInSearch ($isFilterableInSearch)
 
 setPosition ($position)
 
 setApplyTo ($applyTo)
 
 setIsSearchable ($isSearchable)
 
 setIsVisibleInAdvancedSearch ($isVisibleInAdvancedSearch)
 
 setIsComparable ($isComparable)
 
 setIsUsedForPromoRules ($isUsedForPromoRules)
 
 setIsVisibleOnFront ($isVisibleOnFront)
 
 setUsedInProductListing ($usedInProductListing)
 
 setIsVisible ($isVisible)
 
 setScope ($scope)
 
 afterDelete ()
 
 __sleep ()
 
 __wakeup ()
 
 setIsUsedInGrid ($isUsedInGrid)
 
 setIsVisibleInGrid ($isVisibleInGrid)
 
 setIsFilterableInGrid ($isFilterableInGrid)
 
- Public Member Functions inherited from Attribute
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Eav\Api\Data\AttributeOptionInterfaceFactory $optionDataFactory, \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Catalog\Model\Product\ReservedAttributeList $reservedAttributeList, \Magento\Framework\Locale\ResolverInterface $localeResolver, DateTimeFormatterInterface $dateTimeFormatter, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 deleteEntity ()
 
 loadEntityAttributeIdBySet ()
 
 beforeSave ()
 
 afterSave ()
 
 afterDelete ()
 
 getBackendTypeByInput ($type)
 
 getDefaultValueByInput ($type)
 
 getAttributeCodesByFrontendType ($type)
 
 getStoreLabels ()
 
 getStoreLabel ($storeId=null)
 
 getSortWeight ($setId)
 
 getIdentities ()
 
 __sleep ()
 
 __wakeup ()
 
- Public Member Functions inherited from AbstractAttribute
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Eav\Api\Data\AttributeOptionInterfaceFactory $optionDataFactory, \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[], \Magento\Eav\Api\Data\AttributeExtensionFactory $eavExtensionFactory=null, FrontendLabelFactory $frontendLabelFactory=null)
 
 loadByCode ($entityType, $code)
 
 getName ()
 
 setAttributeId ($data)
 
 getAttributeId ()
 
 setAttributeCode ($data)
 
 getAttributeCode ()
 
 setAttributeModel ($data)
 
 getAttributeModel ()
 
 setBackendType ($data)
 
 getBackendType ()
 
 setBackendModel ($data)
 
 getBackendModel ()
 
 setBackendTable ($data)
 
 getIsVisibleOnFront ()
 
 getDefaultValue ()
 
 setDefaultValue ($defaultValue)
 
 getAttributeSetId ()
 
 setAttributeSetId ($id)
 
 getEntityTypeId ()
 
 setEntityTypeId ($id)
 
 setEntityType ($type)
 
 getAlias ($entity=null)
 
 setName ($name)
 
 getEntityType ()
 
 setEntity ($entity)
 
 getEntity ()
 
 getEntityIdField ()
 
 getBackend ()
 
 getFrontend ()
 
 getSource ()
 
 usesSource ()
 
 isValueEmpty ($value)
 
 isAllowedEmptyTextValue ($value)
 
 isInSet ($setId)
 
 isInGroup ($setId, $groupId)
 
 getIdByCode ($entityType, $code)
 
 isStatic ()
 
 getBackendTable ()
 
 getFlatColumns ()
 
 _getFlatColumnsDdlDefinition ()
 
 getFlatIndexes ()
 
 getFlatUpdateSelect ($store=null)
 
 getIsUnique ()
 
 setIsUnique ($isUnique)
 
 getFrontendClass ()
 
 setFrontendClass ($frontendClass)
 
 getFrontendInput ()
 
 setFrontendInput ($frontendInput)
 
 getIsRequired ()
 
 setIsRequired ($isRequired)
 
 getOptions ()
 
 setOptions (array $options=null)
 
 getIsUserDefined ()
 
 setIsUserDefined ($isUserDefined)
 
 getDefaultFrontendLabel ()
 
 setDefaultFrontendLabel ($defaultFrontendLabel)
 
 getFrontendLabels ()
 
 setFrontendLabels (array $frontendLabels=null)
 
 getNote ()
 
 setNote ($note)
 
 getSourceModel ()
 
 setSourceModel ($sourceModel)
 
 getValidationRules ()
 
 setValidationRules (array $validationRules=null)
 
 setExtensionAttributes (\Magento\Eav\Api\Data\AttributeExtensionInterface $extensionAttributes)
 
 __sleep ()
 
 __wakeup ()
 
- Public Member Functions inherited from AbstractExtensibleModel
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 getCustomAttributes ()
 
 getCustomAttribute ($attributeCode)
 
 setCustomAttributes (array $attributes)
 
 setCustomAttribute ($attributeCode, $attributeValue)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 setId ($value)
 
 __sleep ()
 
 __wakeup ()
 
- Public Member Functions inherited from AbstractModel
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 __sleep ()
 
 __wakeup ()
 
 setIdFieldName ($name)
 
 getIdFieldName ()
 
 getId ()
 
 setId ($value)
 
 isDeleted ($isDeleted=null)
 
 hasDataChanges ()
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 setDataChanges ($value)
 
 getOrigData ($key=null)
 
 setOrigData ($key=null, $data=null)
 
 dataHasChangedFor ($field)
 
 getResourceName ()
 
 getResourceCollection ()
 
 getCollection ()
 
 load ($modelId, $field=null)
 
 beforeLoad ($identifier, $field=null)
 
 afterLoad ()
 
 isSaveAllowed ()
 
 setHasDataChanges ($flag)
 
 save ()
 
 afterCommitCallback ()
 
 isObjectNew ($flag=null)
 
 beforeSave ()
 
 validateBeforeSave ()
 
 getCacheTags ()
 
 cleanModelCache ()
 
 afterSave ()
 
 delete ()
 
 beforeDelete ()
 
 afterDelete ()
 
 afterDeleteCommit ()
 
 getResource ()
 
 getEntityId ()
 
 setEntityId ($entityId)
 
 clearInstance ()
 
 getStoredData ()
 
 getEventPrefix ()
 
- Public Member Functions inherited from DataObject
 __construct (array $data=[])
 
 addData (array $arr)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 getDataByPath ($path)
 
 getDataByKey ($key)
 
 setDataUsingMethod ($key, $args=[])
 
 getDataUsingMethod ($key, $args=null)
 
 hasData ($key='')
 
 toArray (array $keys=[])
 
 convertToArray (array $keys=[])
 
 toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 toJson (array $keys=[])
 
 convertToJson (array $keys=[])
 
 toString ($format='')
 
 __call ($method, $args)
 
 isEmpty ()
 
 serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 
 debug ($data=null, &$objects=[])
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 offsetGet ($offset)
 
- Public Member Functions inherited from ProductAttributeInterface
 getExtensionAttributes ()
 

Data Fields

const MODULE_NAME = 'Magento_Catalog'
 
const ENTITY = 'catalog_eav_attribute'
 
const KEY_IS_GLOBAL = 'is_global'
 
- Data Fields inherited from Attribute
const ATTRIBUTE_CODE_MAX_LENGTH = 60
 
const ATTRIBUTE_CODE_MIN_LENGTH = 1
 
const CACHE_TAG = 'EAV_ATTRIBUTE'
 
- Data Fields inherited from AbstractAttribute
const TYPE_STATIC = 'static'
 
const EMPTY_STRING = ''
 
- Data Fields inherited from CustomAttributesDataInterface
const CUSTOM_ATTRIBUTES = 'custom_attributes'
 
- Data Fields inherited from ExtensibleDataInterface
const EXTENSION_ATTRIBUTES_KEY = 'extension_attributes'
 
- Data Fields inherited from AttributeInterface
const ATTRIBUTE_ID = 'attribute_id'
 
const IS_UNIQUE = 'is_unique'
 
const SCOPE = 'scope'
 
const FRONTEND_CLASS = 'frontend_class'
 
const ATTRIBUTE_CODE = 'attribute_code'
 
const FRONTEND_INPUT = 'frontend_input'
 
const IS_REQUIRED = 'is_required'
 
const OPTIONS = 'options'
 
const IS_USER_DEFINED = 'is_user_defined'
 
const FRONTEND_LABEL = 'frontend_label'
 
const FRONTEND_LABELS = 'frontend_labels'
 
const NOTE = 'note'
 
const BACKEND_TYPE = 'backend_type'
 
const BACKEND_MODEL = 'backend_model'
 
const SOURCE_MODEL = 'source_model'
 
const VALIDATE_RULES = 'validate_rules'
 
const ENTITY_TYPE_ID = 'entity_type_id'
 
- Data Fields inherited from ProductAttributeInterface
const ENTITY_TYPE_CODE = 'catalog_product'
 
const CODE_HAS_WEIGHT = 'product_has_weight'
 
const CODE_SPECIAL_PRICE = 'special_price'
 
const CODE_PRICE = 'price'
 
const CODE_TIER_PRICE_FIELD_PRICE_QTY = 'price_qty'
 
const CODE_SHORT_DESCRIPTION = 'short_description'
 
const CODE_SEO_FIELD_META_TITLE = 'meta_title'
 
const CODE_STATUS = 'status'
 
const CODE_NAME = 'name'
 
const CODE_SKU = 'sku'
 
const CODE_SEO_FIELD_META_KEYWORD = 'meta_keyword'
 
const CODE_DESCRIPTION = 'description'
 
const CODE_COST = 'cost'
 
const CODE_SEO_FIELD_URL_KEY = 'url_key'
 
const CODE_TIER_PRICE = 'tier_price'
 
const CODE_TIER_PRICE_FIELD_PRICE = 'price'
 
const CODE_TIER_PRICE_FIELD_PERCENTAGE_VALUE = 'percentage_value'
 
const CODE_TIER_PRICE_FIELD_VALUE_TYPE = 'value_type'
 
const CODE_SEO_FIELD_META_DESCRIPTION = 'meta_description'
 
const CODE_WEIGHT = 'weight'
 
- Data Fields inherited from EavAttributeInterface
const IS_WYSIWYG_ENABLED = 'is_wysiwyg_enabled'
 
const IS_HTML_ALLOWED_ON_FRONT = 'is_html_allowed_on_front'
 
const USED_FOR_SORT_BY = 'used_for_sort_by'
 
const IS_FILTERABLE = 'is_filterable'
 
const IS_FILTERABLE_IN_SEARCH = 'is_filterable_in_search'
 
const IS_USED_IN_GRID = 'is_used_in_grid'
 
const IS_VISIBLE_IN_GRID = 'is_visible_in_grid'
 
const IS_FILTERABLE_IN_GRID = 'is_filterable_in_grid'
 
const POSITION = 'position'
 
const APPLY_TO = 'apply_to'
 
const IS_SEARCHABLE = 'is_searchable'
 
const IS_VISIBLE_IN_ADVANCED_SEARCH = 'is_visible_in_advanced_search'
 
const IS_COMPARABLE = 'is_comparable'
 
const IS_USED_FOR_PROMO_RULES = 'is_used_for_promo_rules'
 
const IS_VISIBLE_ON_FRONT = 'is_visible_on_front'
 
const USED_IN_PRODUCT_LISTING = 'used_in_product_listing'
 
const IS_VISIBLE = 'is_visible'
 
const SCOPE_STORE_TEXT = 'store'
 
const SCOPE_GLOBAL_TEXT = 'global'
 
const SCOPE_WEBSITE_TEXT = 'website'
 
- Data Fields inherited from ScopedAttributeInterface
const SCOPE_STORE = 0
 
const SCOPE_GLOBAL = 1
 
const SCOPE_WEBSITE = 2
 

Protected Member Functions

 _construct ()
 
 _isEnabledInFlat ()
 
 _isOriginalEnabledInFlat ()
 
 _isOriginalIndexable ()
 
- Protected Member Functions inherited from Attribute
 _getDefaultBackendModel ()
 
 _getDefaultSourceModel ()
 
- Protected Member Functions inherited from AbstractAttribute
 getSerializer ()
 
 _construct ()
 
 _getDefaultBackendModel ()
 
 _getDefaultFrontendModel ()
 
 _getDefaultSourceModel ()
 
 _getFlatColumnsOldDefinition ()
 
- Protected Member Functions inherited from AbstractExtensibleModel
 filterCustomAttributes ($data)
 
 initializeCustomAttributes ()
 
 convertCustomAttributeValues (array &$customAttributes)
 
 getCustomAttributesCodes ()
 
 _setExtensionAttributes (\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
 
 _getExtensionAttributes ()
 
- Protected Member Functions inherited from AbstractModel
 _construct ()
 
 _init ($resourceModel)
 
 _setResourceModel ($resourceName, $collectionName=null)
 
 _getResource ()
 
 _getEventData ()
 
 _beforeLoad ($modelId, $field=null)
 
 _afterLoad ()
 
 _hasModelChanged ()
 
 _getValidatorBeforeSave ()
 
 _createValidatorBeforeSave ()
 
 _getValidationRulesBeforeSave ()
 
 _clearReferences ()
 
 _clearData ()
 
- Protected Member Functions inherited from DataObject
 _getData ($key)
 
 _underscore ($name)
 

Protected Attributes

 $attrLockValidator
 
 $_eventObject = 'attribute'
 
 $_eventPrefix = 'catalog_entity_attribute'
 
 $_productFlatIndexerProcessor
 
 $_productFlatIndexerHelper
 
 $_indexerEavProcessor
 
- Protected Attributes inherited from Attribute
 $_eventPrefix = 'eav_entity_attribute'
 
 $_eventObject = 'attribute'
 
 $_cacheTag = self::CACHE_TAG
 
 $_localeDate
 
 $reservedAttributeList
 
 $_localeResolver
 
 $dateTimeFormatter
 
- Protected Attributes inherited from AbstractAttribute
 $_name
 
 $_entity
 
 $_backend
 
 $_frontend
 
 $_source
 
 $_attributeIdCache = []
 
 $_dataTable = null
 
 $_eavConfig
 
 $_eavTypeFactory
 
 $_storeManager
 
 $_resourceHelper
 
 $_universalFactory
 
 $optionDataFactory
 
 $dataObjectProcessor
 
 $dataObjectHelper
 
 $serializer
 
- Protected Attributes inherited from AbstractExtensibleModel
 $extensionAttributesFactory
 
 $extensionAttributes
 
 $customAttributeFactory
 
 $customAttributesCodes = null
 
 $customAttributesChanged = false
 
- Protected Attributes inherited from AbstractModel
 $_eventPrefix = 'core_abstract'
 
 $_eventObject = 'object'
 
 $_idFieldName = 'id'
 
 $_hasDataChanges = false
 
 $_origData
 
 $_isDeleted = false
 
 $_resource
 
 $_resourceCollection
 
 $_resourceName
 
 $_collectionName
 
 $_cacheTag = false
 
 $_dataSaveAllowed = true
 
 $_isObjectNew = null
 
 $_validatorBeforeSave = null
 
 $_eventManager
 
 $_cacheManager
 
 $_registry
 
 $_logger
 
 $_appState
 
 $_actionValidator
 
 $storedData = []
 
- Protected Attributes inherited from DataObject
 $_data = []
 

Static Protected Attributes

static $_labels = null
 
- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

Catalog attribute model

@api @method \Magento\Catalog\Model\ResourceModel\Eav\Attribute getFrontendInputRenderer() @method string setFrontendInputRenderer(string $value) @method int setIsGlobal(int $value) @method int getSearchWeight() @method int setSearchWeight(int $value) @method bool getIsUsedForPriceRules() @method int setIsUsedForPriceRules(int $value)

Author
Magento Core Team core@.nosp@m.mage.nosp@m.ntoco.nosp@m.mmer.nosp@m.ce.co.nosp@m.m @SuppressWarnings(PHPMD.CouplingBetweenObjects) @SuppressWarnings(PHPMD.ExcessivePublicCount) @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
Since
100.0.2

Definition at line 31 of file Attribute.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\Model\Context  $context,
\Magento\Framework\Registry  $registry,
\Magento\Framework\Api\ExtensionAttributesFactory  $extensionFactory,
AttributeValueFactory  $customAttributeFactory,
\Magento\Eav\Model\Config  $eavConfig,
\Magento\Eav\Model\Entity\TypeFactory  $eavTypeFactory,
\Magento\Store\Model\StoreManagerInterface  $storeManager,
\Magento\Eav\Model\ResourceModel\Helper  $resourceHelper,
\Magento\Framework\Validator\UniversalFactory  $universalFactory,
\Magento\Eav\Api\Data\AttributeOptionInterfaceFactory  $optionDataFactory,
\Magento\Framework\Reflection\DataObjectProcessor  $dataObjectProcessor,
\Magento\Framework\Api\DataObjectHelper  $dataObjectHelper,
\Magento\Framework\Stdlib\DateTime\TimezoneInterface  $localeDate,
\Magento\Catalog\Model\Product\ReservedAttributeList  $reservedAttributeList,
\Magento\Framework\Locale\ResolverInterface  $localeResolver,
DateTimeFormatterInterface  $dateTimeFormatter,
\Magento\Catalog\Model\Indexer\Product\Flat\Processor  $productFlatIndexerProcessor,
\Magento\Catalog\Model\Indexer\Product\Eav\Processor  $indexerEavProcessor,
\Magento\Catalog\Helper\Product\Flat\Indexer  $productFlatIndexerHelper,
LockValidatorInterface  $lockValidator,
\Magento\Framework\Model\ResourceModel\AbstractResource  $resource = null,
\Magento\Framework\Data\Collection\AbstractDb  $resourceCollection = null,
array  $data = [],
\Magento\Eav\Api\Data\AttributeExtensionFactory  $eavAttributeFactory = null 
)
Parameters
\Magento\Framework\Model\Context$context
\Magento\Framework\Registry$registry
\Magento\Framework\Api\ExtensionAttributesFactory$extensionFactory
AttributeValueFactory$customAttributeFactory
\Magento\Eav\Model\Config$eavConfig
\Magento\Eav\Model\Entity\TypeFactory$eavTypeFactory
\Magento\Store\Model\StoreManagerInterface$storeManager
\Magento\Eav\Model\ResourceModel\Helper$resourceHelper
\Magento\Framework\Validator\UniversalFactory$universalFactory
\Magento\Eav\Api\Data\AttributeOptionInterfaceFactory$optionDataFactory
\Magento\Framework\Reflection\DataObjectProcessor$dataObjectProcessor
\Magento\Framework\Api\DataObjectHelper$dataObjectHelper
\Magento\Framework\Stdlib\DateTime\TimezoneInterface$localeDate
\Magento\Catalog\Model\Product\ReservedAttributeList$reservedAttributeList
\Magento\Framework\Locale\ResolverInterface$localeResolver
DateTimeFormatterInterface$dateTimeFormatter
\Magento\Catalog\Model\Indexer\Product\Flat\Processor$productFlatIndexerProcessor
\Magento\Catalog\Model\Indexer\Product\Eav\Processor$indexerEavProcessor
\Magento\Catalog\Helper\Product\Flat\Indexer$productFlatIndexerHelper
LockValidatorInterface$lockValidator
\Magento\Framework\Model\ResourceModel\AbstractResource | null$resource
\Magento\Framework\Data\Collection\AbstractDb | null$resourceCollection
array$data
\Magento\Eav\Api\Data\AttributeExtensionFactory | null$eavAttributeFactory@SuppressWarnings(PHPMD.ExcessiveParameterList)

Definition at line 114 of file Attribute.php.

139  {
140  $this->_indexerEavProcessor = $indexerEavProcessor;
141  $this->_productFlatIndexerProcessor = $productFlatIndexerProcessor;
142  $this->_productFlatIndexerHelper = $productFlatIndexerHelper;
143  $this->attrLockValidator = $lockValidator;
144  $this->eavAttributeFactory = $eavAttributeFactory ?: \Magento\Framework\App\ObjectManager::getInstance()
145  ->get(\Magento\Eav\Api\Data\AttributeExtensionFactory::class);
146  parent::__construct(
147  $context,
148  $registry,
149  $extensionFactory,
151  $eavConfig,
152  $eavTypeFactory,
154  $resourceHelper,
155  $universalFactory,
159  $localeDate,
161  $localeResolver,
163  $resource,
164  $resourceCollection,
165  $data
166  );
167  }
$storeManager
$resource
Definition: bulk.php:12

Member Function Documentation

◆ __sleep()

__sleep ( )
Since
100.0.9

Definition at line 844 of file Attribute.php.

845  {
846  $this->unsetData('entity_type');
847  return array_diff(
848  parent::__sleep(),
849  ['_indexerEavProcessor', '_productFlatIndexerProcessor', '_productFlatIndexerHelper', 'attrLockValidator']
850  );
851  }

◆ __wakeup()

__wakeup ( )
Since
100.0.9

Definition at line 857 of file Attribute.php.

858  {
861  $this->_indexerEavProcessor = $objectManager->get(\Magento\Catalog\Model\Indexer\Product\Flat\Processor::class);
862  $this->_productFlatIndexerProcessor = $objectManager->get(
863  \Magento\Catalog\Model\Indexer\Product\Eav\Processor::class
864  );
865  $this->_productFlatIndexerHelper = $objectManager->get(\Magento\Catalog\Helper\Product\Flat\Indexer::class);
866  $this->attrLockValidator = $objectManager->get(LockValidatorInterface::class);
867  }
$objectManager
Definition: bootstrap.php:17

◆ _construct()

_construct ( )
protected
Returns
void

Definition at line 172 of file Attribute.php.

173  {
174  $this->_init(\Magento\Catalog\Model\ResourceModel\Attribute::class);
175  }

◆ _getDefaultSourceModel()

_getDefaultSourceModel ( )

Get default attribute source model

Returns
string

Definition at line 420 of file Attribute.php.

421  {
422  return \Magento\Eav\Model\Entity\Attribute\Source\Table::class;
423  }

◆ _isEnabledInFlat()

_isEnabledInFlat ( )
protected

Is attribute enabled for flat indexing

Returns
bool

Definition at line 256 of file Attribute.php.

257  {
258  return $this->_getData('backend_type') == 'static'
259  || $this->_productFlatIndexerHelper->isAddFilterableAttributes()
260  && $this->_getData('is_filterable') > 0
261  || $this->_getData('used_in_product_listing') == 1
262  || $this->_getData('used_for_sort_by') == 1;
263  }

◆ _isOriginalEnabledInFlat()

_isOriginalEnabledInFlat ( )
protected

Is original attribute enabled for flat indexing

Returns
bool

Definition at line 270 of file Attribute.php.

271  {
272  return $this->getOrigData('backend_type') == 'static'
273  || $this->_productFlatIndexerHelper->isAddFilterableAttributes()
274  && $this->getOrigData('is_filterable') > 0
275  || $this->getOrigData('used_in_product_listing') == 1
276  || $this->getOrigData('used_for_sort_by') == 1;
277  }

◆ _isOriginalIndexable()

_isOriginalIndexable ( )
protected

Is original attribute config indexable

Returns
bool @SuppressWarnings(PHPMD.CyclomaticComplexity)

Definition at line 465 of file Attribute.php.

466  {
467  // exclude price attribute
468  if ($this->getOrigData('attribute_code') == 'price') {
469  return false;
470  }
471 
472  if (!$this->getOrigData('is_filterable_in_search')
473  && !$this->getOrigData('is_visible_in_advanced_search')
474  && !$this->getOrigData('is_filterable')) {
475  return false;
476  }
477 
478  $backendType = $this->getOrigData('backend_type');
479  $frontendInput = $this->getOrigData('frontend_input');
480 
481  if ($backendType == 'int' && $frontendInput == 'select') {
482  return true;
483  } elseif ($backendType == 'varchar' && $frontendInput == 'multiselect') {
484  return true;
485  } elseif ($backendType == 'decimal') {
486  return true;
487  }
488 
489  return false;
490  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17

◆ afterDelete()

afterDelete ( )

{}

Definition at line 834 of file Attribute.php.

835  {
836  $this->_eavConfig->clear();
837  return parent::afterDelete();
838  }

◆ afterDeleteCommit()

afterDeleteCommit ( )

Init indexing process after catalog eav attribute delete commit

Returns
$this

Definition at line 296 of file Attribute.php.

297  {
298  parent::afterDeleteCommit();
299 
300  if ($this->_isOriginalEnabledInFlat()) {
301  $this->_productFlatIndexerProcessor->markIndexerAsInvalid();
302  }
303  if ($this->_isOriginalIndexable()) {
304  $this->_indexerEavProcessor->markIndexerAsInvalid();
305  }
306  return $this;
307  }

◆ afterSave()

afterSave ( )

Processing object after save data

Returns
\Magento\Framework\Model\AbstractModel

Fix saving attribute in admin

Definition at line 222 of file Attribute.php.

223  {
227  $this->_eavConfig->clear();
228 
229  if ($this->_isOriginalEnabledInFlat() != $this->_isEnabledInFlat()) {
230  $this->_productFlatIndexerProcessor->markIndexerAsInvalid();
231  }
232  if ($this->_isOriginalIndexable() !== $this->isIndexable()
233  || ($this->isIndexable() && $this->dataHasChangedFor(self::KEY_IS_GLOBAL))
234  ) {
235  $this->_indexerEavProcessor->markIndexerAsInvalid();
236  }
237 
238  return parent::afterSave();
239  }

◆ beforeDelete()

beforeDelete ( )

Register indexing event before delete catalog eav attribute

Returns
$this
Exceptions

Definition at line 285 of file Attribute.php.

286  {
287  $this->attrLockValidator->validate($this);
288  return parent::beforeDelete();
289  }

◆ beforeSave()

beforeSave ( )

Processing object before save data

Returns
\Magento\Framework\Model\AbstractModel
Exceptions

Definition at line 184 of file Attribute.php.

185  {
186  $this->setData('modulePrefix', self::MODULE_NAME);
187  if (isset($this->_origData[self::KEY_IS_GLOBAL])) {
188  if (!isset($this->_data[self::KEY_IS_GLOBAL])) {
189  $this->_data[self::KEY_IS_GLOBAL] = self::SCOPE_GLOBAL;
190  }
191  if ($this->_data[self::KEY_IS_GLOBAL] != $this->_origData[self::KEY_IS_GLOBAL]) {
192  try {
193  $this->attrLockValidator->validate($this);
194  } catch (\Magento\Framework\Exception\LocalizedException $exception) {
195  throw new \Magento\Framework\Exception\LocalizedException(
196  __('Do not change the scope. %1', $exception->getMessage())
197  );
198  }
199  }
200  }
201  if ($this->getFrontendInput() == 'price') {
202  if (!$this->getBackendModel()) {
203  $this->setBackendModel(\Magento\Catalog\Model\Product\Attribute\Backend\Price::class);
204  }
205  }
206  if ($this->getFrontendInput() == 'textarea') {
207  if ($this->getIsWysiwygEnabled()) {
208  $this->setIsHtmlAllowedOnFront(1);
209  }
210  }
211  if (!$this->getIsSearchable()) {
212  $this->setIsVisibleInAdvancedSearch(false);
213  }
214  return parent::beforeSave();
215  }
__()
Definition: __.php:13
setIsVisibleInAdvancedSearch($isVisibleInAdvancedSearch)
Definition: Attribute.php:751

◆ getApplyTo()

getApplyTo ( )

Retrieve apply to products array Return empty array if applied to all products

Returns
string[]

Implements EavAttributeInterface.

Definition at line 369 of file Attribute.php.

370  {
371  $applyTo = $this->_getData(self::APPLY_TO) ?: [];
372  if (!is_array($applyTo)) {
373  $applyTo = explode(',', $applyTo);
374  }
375  return $applyTo;
376  }

◆ getIndexType()

getIndexType ( )

Retrieve index type for indexable attribute

Returns
string|false

Definition at line 497 of file Attribute.php.

498  {
499  if (!$this->isIndexable()) {
500  return false;
501  }
502  if ($this->getBackendType() == 'decimal') {
503  return 'decimal';
504  }
505 
506  return 'source';
507  }

◆ getIsComparable()

getIsComparable ( )

{Whether the attribute can be compared on the frontend

Returns
string|null
}

Implements EavAttributeInterface.

Definition at line 601 of file Attribute.php.

602  {
603  return $this->_getData(self::IS_COMPARABLE);
604  }

◆ getIsFilterable()

getIsFilterable ( )

{Whether it used in layered navigation

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 537 of file Attribute.php.

538  {
539  return $this->_getData(self::IS_FILTERABLE);
540  }

◆ getIsFilterableInGrid()

getIsFilterableInGrid ( )

{Whether it is filterable in catalog product grid

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 569 of file Attribute.php.

570  {
571  return (bool)$this->_getData(self::IS_FILTERABLE_IN_GRID);
572  }

◆ getIsFilterableInSearch()

getIsFilterableInSearch ( )

{Whether it is used in search results layered navigation

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 545 of file Attribute.php.

546  {
547  return $this->_getData(self::IS_FILTERABLE_IN_SEARCH);
548  }

◆ getIsGlobal()

getIsGlobal ( )

Return is attribute global

Returns
integer

Definition at line 314 of file Attribute.php.

315  {
316  return $this->_getData(self::KEY_IS_GLOBAL);
317  }

◆ getIsHtmlAllowedOnFront()

getIsHtmlAllowedOnFront ( )

{Whether the HTML tags are allowed on the frontend

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 521 of file Attribute.php.

522  {
523  return $this->_getData(self::IS_HTML_ALLOWED_ON_FRONT);
524  }

◆ getIsSearchable()

getIsSearchable ( )

{Whether the attribute can be used in Quick Search

Returns
string|null
}

Implements EavAttributeInterface.

Definition at line 585 of file Attribute.php.

586  {
587  return $this->_getData(self::IS_SEARCHABLE);
588  }

◆ getIsUsedForPromoRules()

getIsUsedForPromoRules ( )

{Whether the attribute can be used for promo rules

Returns
string|null
}

Implements EavAttributeInterface.

Definition at line 609 of file Attribute.php.

610  {
611  return $this->_getData(self::IS_USED_FOR_PROMO_RULES);
612  }

◆ getIsUsedInGrid()

getIsUsedInGrid ( )

{Whether it is used in catalog product grid

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 553 of file Attribute.php.

554  {
555  return (bool)$this->_getData(self::IS_USED_IN_GRID);
556  }

◆ getIsVisible()

getIsVisible ( )

{Whether attribute is visible on frontend.

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 633 of file Attribute.php.

634  {
635  return $this->_getData(self::IS_VISIBLE);
636  }

◆ getIsVisibleInAdvancedSearch()

getIsVisibleInAdvancedSearch ( )

{Whether the attribute can be used in Advanced Search

Returns
string|null
}

Implements EavAttributeInterface.

Definition at line 593 of file Attribute.php.

594  {
595  return $this->_getData(self::IS_VISIBLE_IN_ADVANCED_SEARCH);
596  }

◆ getIsVisibleInGrid()

getIsVisibleInGrid ( )

{Whether it is visible in catalog product grid

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 561 of file Attribute.php.

562  {
563  return (bool)$this->_getData(self::IS_VISIBLE_IN_GRID);
564  }

◆ getIsVisibleOnFront()

getIsVisibleOnFront ( )

{Whether the attribute is visible on the frontend

Returns
string|null
}

Implements EavAttributeInterface.

Definition at line 617 of file Attribute.php.

618  {
619  return $this->_getData(self::IS_VISIBLE_ON_FRONT);
620  }

◆ getIsWysiwygEnabled()

getIsWysiwygEnabled ( )

@codeCoverageIgnoreStart {Enable WYSIWYG flag

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 513 of file Attribute.php.

514  {
515  return $this->_getData(self::IS_WYSIWYG_ENABLED);
516  }

◆ getPosition()

getPosition ( )

{Get position

Returns
int|null
}

Implements EavAttributeInterface.

Definition at line 577 of file Attribute.php.

578  {
579  return $this->_getData(self::POSITION);
580  }

◆ getScope()

getScope ( )

{Retrieve attribute scope

Returns
string|null
}

Implements EavAttributeInterface.

Definition at line 643 of file Attribute.php.

◆ getSourceModel()

getSourceModel ( )

Retrieve source model

Returns
\Magento\Eav\Model\Entity\Attribute\Source\AbstractSource

Implements AttributeInterface.

Definition at line 383 of file Attribute.php.

384  {
385  $model = $this->_getData('source_model');
386  if (empty($model)) {
387  if ($this->getBackendType() == 'int' && $this->getFrontendInput() == 'select') {
388  return $this->_getDefaultSourceModel();
389  }
390  }
391  return $model;
392  }

◆ getStoreId()

getStoreId ( )

Retrieve store id

Returns
int

Definition at line 354 of file Attribute.php.

355  {
356  $dataObject = $this->getDataObject();
357  if ($dataObject) {
358  return $dataObject->getStoreId();
359  }
360  return $this->_getData('store_id');
361  }

◆ getUsedForSortBy()

getUsedForSortBy ( )

{Whether it is used for sorting in product listing

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 529 of file Attribute.php.

530  {
531  return $this->_getData(self::USED_FOR_SORT_BY);
532  }

◆ getUsedInProductListing()

getUsedInProductListing ( )

{Whether the attribute can be used in product listing

Returns
string|null
}

Implements EavAttributeInterface.

Definition at line 625 of file Attribute.php.

626  {
627  return $this->_getData(self::USED_IN_PRODUCT_LISTING);
628  }

◆ isAllowedForRuleCondition()

isAllowedForRuleCondition ( )

Whether allowed for rule condition

Returns
bool

Definition at line 399 of file Attribute.php.

400  {
401  $allowedInputTypes = [
402  'boolean',
403  'date',
404  'datetime',
405  'multiselect',
406  'price',
407  'select',
408  'text',
409  'textarea',
410  'weight',
411  ];
412  return $this->getIsVisible() && in_array($this->getFrontendInput(), $allowedInputTypes);
413  }

◆ isEnabledInFlat()

isEnabledInFlat ( )

Is attribute enabled for flat indexing

Returns
bool

Definition at line 246 of file Attribute.php.

247  {
248  return $this->_isEnabledInFlat();
249  }

◆ isIndexable()

isIndexable ( )

Check is an attribute used in EAV index

Returns
bool @SuppressWarnings(PHPMD.CyclomaticComplexity)

Definition at line 431 of file Attribute.php.

432  {
433  // exclude price attribute
434  if ($this->getAttributeCode() == 'price') {
435  return false;
436  }
437  if ($this->getAttributeCode() == 'visibility') {
438  return true;
439  }
440 
441  if (!$this->getIsFilterableInSearch() && !$this->getIsVisibleInAdvancedSearch() && !$this->getIsFilterable()) {
442  return false;
443  }
444 
445  $backendType = $this->getBackendType();
446  $frontendInput = $this->getFrontendInput();
447 
448  if ($backendType == 'int' && $frontendInput == 'select') {
449  return true;
450  } elseif ($backendType == 'varchar' && $frontendInput == 'multiselect') {
451  return true;
452  } elseif ($backendType == 'decimal') {
453  return true;
454  }
455 
456  return false;
457  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17

◆ isScopeGlobal()

isScopeGlobal ( )

Retrieve attribute is global scope flag

Returns
bool

Definition at line 324 of file Attribute.php.

◆ isScopeStore()

isScopeStore ( )

Retrieve attribute is store scope flag

Returns
bool

Definition at line 344 of file Attribute.php.

◆ isScopeWebsite()

isScopeWebsite ( )

Retrieve attribute is website scope website

Returns
bool

Definition at line 334 of file Attribute.php.

◆ setApplyTo()

setApplyTo (   $applyTo)

Set apply to value for the element

Parameters
string[]|string
Returns
$this

Implements EavAttributeInterface.

Definition at line 726 of file Attribute.php.

727  {
728  if (is_array($applyTo)) {
729  $applyTo = implode(',', $applyTo);
730  }
731  return $this->setData(self::APPLY_TO, $applyTo);
732  }

◆ setIsComparable()

setIsComparable (   $isComparable)

Set whether the attribute can be compared on the frontend

Parameters
string$isComparable
Returns
$this

Implements EavAttributeInterface.

Definition at line 762 of file Attribute.php.

763  {
764  return $this->setData(self::IS_COMPARABLE, $isComparable);
765  }

◆ setIsFilterable()

setIsFilterable (   $isFilterable)

Set whether it used in layered navigation

Parameters
bool$isFilterable
Returns
$this

Implements EavAttributeInterface.

Definition at line 693 of file Attribute.php.

694  {
695  return $this->setData(self::IS_FILTERABLE, $isFilterable);
696  }

◆ setIsFilterableInGrid()

setIsFilterableInGrid (   $isFilterableInGrid)

Set is attribute filterable in grid

Parameters
bool | null$isFilterableInGrid
Returns
$this
Since
102.0.0

Since
102.0.0

Implements EavAttributeInterface.

Definition at line 893 of file Attribute.php.

894  {
895  $this->setData(self::IS_FILTERABLE_IN_GRID, $isFilterableInGrid);
896  return $this;
897  }

◆ setIsFilterableInSearch()

setIsFilterableInSearch (   $isFilterableInSearch)

Set whether it is used in search results layered navigation

Parameters
bool$isFilterableInSearch
Returns
$this

Implements EavAttributeInterface.

Definition at line 704 of file Attribute.php.

705  {
706  return $this->setData(self::IS_FILTERABLE_IN_SEARCH, $isFilterableInSearch);
707  }

◆ setIsHtmlAllowedOnFront()

setIsHtmlAllowedOnFront (   $isHtmlAllowedOnFront)

Set whether the HTML tags are allowed on the frontend

Parameters
bool$isHtmlAllowedOnFront
Returns
$this

Implements EavAttributeInterface.

Definition at line 671 of file Attribute.php.

672  {
673  return $this->setData(self::IS_HTML_ALLOWED_ON_FRONT, $isHtmlAllowedOnFront);
674  }

◆ setIsSearchable()

setIsSearchable (   $isSearchable)

Whether the attribute can be used in Quick Search

Parameters
string$isSearchable
Returns
$this

Implements EavAttributeInterface.

Definition at line 740 of file Attribute.php.

741  {
742  return $this->setData(self::IS_SEARCHABLE, $isSearchable);
743  }

◆ setIsUsedForPromoRules()

setIsUsedForPromoRules (   $isUsedForPromoRules)

Set whether the attribute can be used for promo rules

Parameters
string$isUsedForPromoRules
Returns
$this

Implements EavAttributeInterface.

Definition at line 773 of file Attribute.php.

774  {
775  return $this->setData(self::IS_USED_FOR_PROMO_RULES, $isUsedForPromoRules);
776  }

◆ setIsUsedInGrid()

setIsUsedInGrid (   $isUsedInGrid)

Set is attribute used in grid

Parameters
bool | null$isUsedInGrid
Returns
$this
Since
102.0.0

Since
102.0.0

Implements EavAttributeInterface.

Definition at line 873 of file Attribute.php.

874  {
875  $this->setData(self::IS_USED_IN_GRID, $isUsedInGrid);
876  return $this;
877  }

◆ setIsVisible()

setIsVisible (   $isVisible)

Set whether attribute is visible on frontend.

Parameters
bool$isVisible
Returns
$this

Implements EavAttributeInterface.

Definition at line 806 of file Attribute.php.

807  {
808  return $this->setData(self::IS_VISIBLE, $isVisible);
809  }

◆ setIsVisibleInAdvancedSearch()

setIsVisibleInAdvancedSearch (   $isVisibleInAdvancedSearch)

Set whether the attribute can be used in Advanced Search

Parameters
string$isVisibleInAdvancedSearch
Returns
$this

Implements EavAttributeInterface.

Definition at line 751 of file Attribute.php.

752  {
753  return $this->setData(self::IS_VISIBLE_IN_ADVANCED_SEARCH, $isVisibleInAdvancedSearch);
754  }

◆ setIsVisibleInGrid()

setIsVisibleInGrid (   $isVisibleInGrid)

Set is attribute visible in grid

Parameters
bool | null$isVisibleInGrid
Returns
$this
Since
102.0.0

Since
102.0.0

Implements EavAttributeInterface.

Definition at line 883 of file Attribute.php.

884  {
885  $this->setData(self::IS_VISIBLE_IN_GRID, $isVisibleInGrid);
886  return $this;
887  }

◆ setIsVisibleOnFront()

setIsVisibleOnFront (   $isVisibleOnFront)

Set whether the attribute is visible on the frontend

Parameters
string$isVisibleOnFront
Returns
$this

Implements EavAttributeInterface.

Definition at line 784 of file Attribute.php.

785  {
786  return $this->setData(self::IS_VISIBLE_ON_FRONT, $isVisibleOnFront);
787  }

◆ setIsWysiwygEnabled()

setIsWysiwygEnabled (   $isWysiwygEnabled)

Set whether WYSIWYG is enabled flag

Parameters
bool$isWysiwygEnabled
Returns
$this

Implements EavAttributeInterface.

Definition at line 660 of file Attribute.php.

661  {
662  return $this->setData(self::IS_WYSIWYG_ENABLED, $isWysiwygEnabled);
663  }

◆ setPosition()

setPosition (   $position)

Set position

Parameters
int$position
Returns
$this

Implements EavAttributeInterface.

Definition at line 715 of file Attribute.php.

716  {
717  return $this->setData(self::POSITION, $position);
718  }

◆ setScope()

setScope (   $scope)

Set attribute scope

Parameters
string$scope
Returns
$this

Implements EavAttributeInterface.

Definition at line 817 of file Attribute.php.

818  {
819  if ($scope == self::SCOPE_GLOBAL_TEXT) {
820  return $this->setData(self::KEY_IS_GLOBAL, self::SCOPE_GLOBAL);
821  } elseif ($scope == self::SCOPE_WEBSITE_TEXT) {
822  return $this->setData(self::KEY_IS_GLOBAL, self::SCOPE_WEBSITE);
823  } elseif ($scope == self::SCOPE_STORE_TEXT) {
824  return $this->setData(self::KEY_IS_GLOBAL, self::SCOPE_STORE);
825  } else {
826  //Ignore unrecognized scope
827  return $this;
828  }
829  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17

◆ setUsedForSortBy()

setUsedForSortBy (   $usedForSortBy)

Set whether it is used for sorting in product listing

Parameters
bool$usedForSortBy
Returns
$this

Implements EavAttributeInterface.

Definition at line 682 of file Attribute.php.

683  {
684  return $this->setData(self::USED_FOR_SORT_BY, $usedForSortBy);
685  }

◆ setUsedInProductListing()

setUsedInProductListing (   $usedInProductListing)

Set whether the attribute can be used in product listing

Parameters
string$usedInProductListing
Returns
$this

Implements EavAttributeInterface.

Definition at line 795 of file Attribute.php.

796  {
797  return $this->setData(self::USED_IN_PRODUCT_LISTING, $usedInProductListing);
798  }

Field Documentation

◆ $_eventObject

$_eventObject = 'attribute'
protected

Definition at line 51 of file Attribute.php.

◆ $_eventPrefix

$_eventPrefix = 'catalog_entity_attribute'
protected

Definition at line 65 of file Attribute.php.

◆ $_indexerEavProcessor

$_indexerEavProcessor
protected

Definition at line 80 of file Attribute.php.

◆ $_labels

$_labels = null
staticprotected

Definition at line 58 of file Attribute.php.

◆ $_productFlatIndexerHelper

$_productFlatIndexerHelper
protected

Definition at line 75 of file Attribute.php.

◆ $_productFlatIndexerProcessor

$_productFlatIndexerProcessor
protected

Definition at line 70 of file Attribute.php.

◆ $attrLockValidator

$attrLockValidator
protected

Definition at line 44 of file Attribute.php.

◆ ENTITY

const ENTITY = 'catalog_eav_attribute'

Definition at line 37 of file Attribute.php.

◆ KEY_IS_GLOBAL

const KEY_IS_GLOBAL = 'is_global'

Definition at line 39 of file Attribute.php.

◆ MODULE_NAME

const MODULE_NAME = 'Magento_Catalog'

Definition at line 35 of file Attribute.php.


The documentation for this class was generated from the following file: