![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-catalog/Block/Adminhtml/Product/Edit/Action/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /** * Adminhtml catalog product action attribute update * * @author Magento Core Team <[email protected]> */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Action; use Magento\Catalog\Helper\Product\Edit\Action\Attribute as ActionAttribute; use Magento\Catalog\Model\ResourceModel\Product\Collection; /** * @api * @since 100.0.2 */ class Attribute extends \Magento\Backend\Block\Widget { /** * Adminhtml catalog product edit action attribute * * @var ActionAttribute */ protected $_helperActionAttribute = null; /** * @param \Magento\Backend\Block\Template\Context $context * @param ActionAttribute $helperActionAttribute * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, ActionAttribute $helperActionAttribute, array $data = [] ) { $this->_helperActionAttribute = $helperActionAttribute; parent::__construct($context, $data); } /** * @return void */ protected function _prepareLayout() { $this->getToolbar()->addChild( 'back_button', \Magento\Backend\Block\Widget\Button::class, [ 'label' => __('Back'), 'onclick' => 'setLocation(\'' . $this->getUrl( 'catalog/product/', ['store' => $this->getRequest()->getParam('store', 0)] ) . '\')', 'class' => 'back' ] ); $this->getToolbar()->addChild( 'reset_button', \Magento\Backend\Block\Widget\Button::class, [ 'label' => __('Reset'), 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/*', ['_current' => true]) . '\')', 'class' => 'reset' ] ); $this->getToolbar()->addChild( 'save_button', \Magento\Backend\Block\Widget\Button::class, [ 'label' => __('Save'), 'class' => 'save primary', 'data_attribute' => [ 'mage-init' => ['button' => ['event' => 'save', 'target' => '#attributes-edit-form']], ] ] ); } /** * Retrieve selected products for update * * @return Collection */ public function getProducts() { return $this->_getHelper()->getProducts(); } /** * Retrieve block attributes update helper * * @return ActionAttribute|null */ protected function _getHelper() { return $this->_helperActionAttribute; } /** * Retrieve back button html code * * @return string */ public function getBackButtonHtml() { return $this->getChildHtml('back_button'); } /** * Retrieve cancel button html code * * @return string */ public function getCancelButtonHtml() { return $this->getChildHtml('reset_button'); } /** * Retrieve save button html code * * @return string */ public function getSaveButtonHtml() { return $this->getChildHtml('save_button'); } /** * Get save url * * @return string */ public function getSaveUrl() { $helper = $this->_helperActionAttribute; return $this->getUrl('*/*/save', ['store' => $helper->getSelectedStoreId()]); } /** * Get validation url * * @return string */ public function getValidationUrl() { return $this->getUrl('catalog/*/validate', ['_current' => true]); } }