Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
Attribute Class Reference
Inheritance diagram for Attribute:
Action AbstractAction Action AbstractAction ActionInterface Save

Public Member Functions

 __construct (Action\Context $context, \Magento\Catalog\Helper\Product\Edit\Action\Attribute $attributeHelper)
 
- Public Member Functions inherited from AbstractAction
 __construct (Action\Context $context)
 
 dispatch (\Magento\Framework\App\RequestInterface $request)
 
 _processUrlKeys ()
 
 getUrl ($route='', $params=[])
 
- Public Member Functions inherited from Action
 __construct (Context $context)
 
 dispatch (RequestInterface $request)
 
 getActionFlag ()
 
- Public Member Functions inherited from AbstractAction
 __construct (Context $context)
 
 dispatch (RequestInterface $request)
 
 getRequest ()
 
 getResponse ()
 
- Public Member Functions inherited from ActionInterface
 execute ()
 

Data Fields

const ADMIN_RESOURCE = 'Magento_Catalog::update_attributes'
 
- Data Fields inherited from AbstractAction
const FLAG_IS_URLS_CHECKED = 'check_url_settings'
 
const SESSION_NAMESPACE = 'adminhtml'
 
const ADMIN_RESOURCE = 'Magento_Backend::admin'
 
- Data Fields inherited from ActionInterface
const FLAG_NO_DISPATCH = 'no-dispatch'
 
const FLAG_NO_POST_DISPATCH = 'no-postDispatch'
 
const FLAG_NO_DISPATCH_BLOCK_EVENT = 'no-beforeGenerateLayoutBlocksDispatch'
 
const PARAM_NAME_BASE64_URL = 'r64'
 
const PARAM_NAME_URL_ENCODED = 'uenc'
 

Protected Member Functions

 _validateProducts ()
 
- Protected Member Functions inherited from AbstractAction
 _isAllowed ()
 
 _getSession ()
 
 getMessageManager ()
 
 _addBreadcrumb ($label, $title, $link=null)
 
 _addContent (\Magento\Framework\View\Element\AbstractBlock $block)
 
 _addLeft (\Magento\Framework\View\Element\AbstractBlock $block)
 
 _addJs (\Magento\Framework\View\Element\AbstractBlock $block)
 
 _isUrlChecked ()
 
 _processLocaleSettings ()
 
 _redirect ($path, $arguments=[])
 
 _forward ($action, $controller=null, $module=null, array $params=null)
 
 _validateSecretKey ()
 
- Protected Member Functions inherited from Action
 _forward ($action, $controller=null, $module=null, array $params=null)
 
 _redirect ($path, $arguments=[])
 

Protected Attributes

 $attributeHelper
 
- Protected Attributes inherited from AbstractAction
 $_publicActions = []
 
 $_sessionNamespace = self::SESSION_NAMESPACE
 
 $_helper
 
 $_session
 
 $_authorization
 
 $_auth
 
 $_backendUrl
 
 $_localeResolver
 
 $_canUseBaseUrl
 
 $_formKeyValidator
 
- Protected Attributes inherited from Action
 $_objectManager
 
 $_sessionNamespace
 
 $_eventManager
 
 $_actionFlag
 
 $_redirect
 
 $_view
 
 $_url
 
 $messageManager
 
- Protected Attributes inherited from AbstractAction
 $_request
 
 $_response
 
 $resultRedirectFactory
 
 $resultFactory
 

Detailed Description

Adminhtml catalog product action attribute update controller

Definition at line 14 of file Attribute.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Action\Context  $context,
\Magento\Catalog\Helper\Product\Edit\Action\Attribute  $attributeHelper 
)
Parameters
Action\Context$context
\Magento\Catalog\Helper\Product\Edit\Action\Attribute$attributeHelper

Definition at line 32 of file Attribute.php.

35  {
36  parent::__construct($context);
37  $this->attributeHelper = $attributeHelper;
38  }

Member Function Documentation

◆ _validateProducts()

_validateProducts ( )
protected

Validate selection of products for mass update

Returns
boolean

Definition at line 45 of file Attribute.php.

46  {
47  $error = false;
48  $productIds = $this->attributeHelper->getProductIds();
49  if (!is_array($productIds)) {
50  $error = __('Please select products for attributes update.');
51  } elseif (!$this->_objectManager->create(\Magento\Catalog\Model\Product::class)
52  ->isProductsHasSku($productIds)) {
53  $error = __('Please make sure to define SKU values for all processed products.');
54  }
55 
56  if ($error) {
57  $this->messageManager->addErrorMessage($error);
58  }
59 
60  return !$error;
61  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
__()
Definition: __.php:13

Field Documentation

◆ $attributeHelper

$attributeHelper
protected

Definition at line 26 of file Attribute.php.

◆ ADMIN_RESOURCE

const ADMIN_RESOURCE = 'Magento_Catalog::update_attributes'

Authorization level of a basic admin session

See also
_isAllowed()

Definition at line 21 of file Attribute.php.


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