/** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Newsletter\Model\TemplateFactory $templateFactory * @param \Magento\Newsletter\Model\QueueFactory $queueFactory * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory * @param array $data */ public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Newsletter\Model\TemplateFactory $templateFactory, \Magento\Newsletter\Model\QueueFactory $queueFactory, \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, array $data = []) { $this->_templateFactory = $templateFactory; $this->_queueFactory = $queueFactory; $this->_subscriberFactory = $subscriberFactory; parent::__construct($context, $data); }
/** * @return Widget */ protected function _prepareLayout() { $this->addChild('add_button', 'Magento\\Backend\\Block\\Widget\\Button', array('label' => __('Add New Option'), 'class' => 'add', 'id' => 'add_new_defined_option')); $this->addChild('options_box', 'Magento\\Catalog\\Block\\Adminhtml\\Product\\Edit\\Tab\\Options\\Option'); $this->addChild('import_button', 'Magento\\Backend\\Block\\Widget\\Button', array('label' => __('Import Options'), 'class' => 'add', 'id' => 'import_new_defined_option')); return parent::_prepareLayout(); }
/** * Define block template * * @return void */ protected function _construct() { if (!$this->hasTemplate()) { $this->setTemplate('Magento_Backend::widget/button/split.phtml'); } parent::_construct(); }
/** * Before rendering html, but after trying to load cache * * @return void */ protected function _beforeToHtml() { if ($this->getParentBlock() && ($order = $this->getOrder())) { $this->setEntity($order); } parent::_beforeToHtml(); }
/** * @return void */ public function _construct() { if ($this->hasData('grouped')) { $this->_isGrouped = (bool) $this->getData('grouped'); } parent::_construct(); }
/** * Prepare layout * * @return $this */ protected function _prepareLayout() { $this->setData('opened', true); $this->addChild('add_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Create New Option'), 'class' => 'add', 'id' => 'add_new_option', 'on_click' => 'bOption.add()']); $this->setChild('options_box', $this->getLayout()->createBlock('Magento\\Bundle\\Block\\Adminhtml\\Catalog\\Product\\Edit\\Tab\\Bundle\\Option', 'adminhtml.catalog.product.edit.tab.bundle.option')); return parent::_prepareLayout(); }
/** * @return AbstractBlock */ protected function _prepareLayout() { $this->addChild('uploader', 'Magento\\Backend\\Block\\Media\\Uploader'); $this->getUploader()->getConfig()->setUrl($this->_urlBuilder->addSessionParam()->getUrl('catalog/product_gallery/upload'))->setFileField('image')->setFilters(['images' => ['label' => __('Images (.gif, .jpg, .png)'), 'files' => ['*.gif', '*.jpg', '*.jpeg', '*.png']]]); $this->_eventManager->dispatch('catalog_product_gallery_prepare_layout', ['block' => $this]); return parent::_prepareLayout(); }
/** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param PriceCurrencyInterface $priceCurrency * @param array $data */ public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, PriceCurrencyInterface $priceCurrency, array $data = []) { $this->priceCurrency = $priceCurrency; $this->_sessionQuote = $sessionQuote; $this->_orderCreate = $orderCreate; parent::__construct($context, $data); }
/** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder * @param \Magento\Eav\Model\Entity\Attribute\SetFactory $setFactory * @param \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory * @param \Magento\Framework\Registry $registry * @param array $data */ public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\Eav\Model\Entity\Attribute\SetFactory $setFactory, \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory, \Magento\Framework\Registry $registry, array $data = []) { $this->_jsonEncoder = $jsonEncoder; $this->_setFactory = $setFactory; $this->_attributeFactory = $attributeFactory; $this->_coreRegistry = $registry; parent::__construct($context, $data); }
/** * Initialize block * * @return void */ protected function _construct() { parent::_construct(); $this->setProductId($this->getRequest()->getParam('id')); $this->setId('config_super_product'); $this->setCanEditPrice(true); $this->setCanReadPrice(true); }
/** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Framework\Registry $coreRegistry * @param \Magento\Framework\UrlInterface $urlBuilder * @param \Sebwite\ProductDownloads\Model\Download $download * @param ScopeConfigInterface $scopeConfig * @param array $data */ public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Framework\Registry $coreRegistry, \Magento\Framework\UrlInterface $urlBuilder, \Sebwite\ProductDownloads\Model\Download $download, ScopeConfigInterface $scopeConfig, array $data = []) { $this->coreRegistry = $coreRegistry; $this->download = $download; $this->urlBuilder = $urlBuilder; $this->scopeConfig = $scopeConfig; parent::__construct($context, $data); }
/** * {@inheritdoc} */ protected function _prepareLayout() { $this->getToolbar()->addChild('back_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Back'), 'onclick' => 'setLocation(\'' . $this->getUrl('adminhtml/*/') . '\')', 'class' => 'back']); if ($this->getDesignChangeId()) { $this->getToolbar()->addChild('delete_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Delete'), 'onclick' => 'deleteConfirm(\'' . __('Are you sure?') . '\', \'' . $this->getDeleteUrl() . '\')', 'class' => 'delete']); } $this->getToolbar()->addChild('save_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Save'), 'class' => 'save primary', 'data_attribute' => ['mage-init' => ['button' => ['event' => 'save', 'target' => '#design-edit-form']]]]); return parent::_prepareLayout(); }
/** * @param \Magento\Backend\Block\Template\Context $context * @param GroupRepositoryInterface $groupRepository * @param \Magento\Directory\Helper\Data $directoryHelper * @param \Magento\Framework\Module\Manager $moduleManager * @param \Magento\Framework\Registry $registry * @param GroupManagementInterface $groupManagement * @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder * @param array $data */ public function __construct(\Magento\Backend\Block\Template\Context $context, GroupRepositoryInterface $groupRepository, \Magento\Directory\Helper\Data $directoryHelper, \Magento\Framework\Module\Manager $moduleManager, \Magento\Framework\Registry $registry, GroupManagementInterface $groupManagement, \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder, array $data = []) { $this->_groupRepository = $groupRepository; $this->_directoryHelper = $directoryHelper; $this->moduleManager = $moduleManager; $this->_coreRegistry = $registry; $this->_groupManagement = $groupManagement; $this->_searchCriteriaBuilder = $searchCriteriaBuilder; parent::__construct($context, $data); }
/** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\CatalogInventory\Model\Source\Backorders $backorders * @param \Magento\CatalogInventory\Model\Source\Stock $stock * @param \Magento\Framework\Module\Manager $moduleManager * @param \Magento\Framework\Registry $coreRegistry * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry * @param \Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration * @param array $data */ public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\CatalogInventory\Model\Source\Backorders $backorders, \Magento\CatalogInventory\Model\Source\Stock $stock, \Magento\Framework\Module\Manager $moduleManager, \Magento\Framework\Registry $coreRegistry, \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry, \Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration, array $data = []) { $this->stock = $stock; $this->backorders = $backorders; $this->moduleManager = $moduleManager; $this->coreRegistry = $coreRegistry; $this->stockRegistry = $stockRegistry; $this->stockConfiguration = $stockConfiguration; parent::__construct($context, $data); }
/** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder * @param \Magento\MediaStorage\Helper\File\Storage\Database $coreFileStorageDatabase * @param \Magento\Downloadable\Helper\File $downloadableFile * @param \Magento\Framework\Registry $coreRegistry * @param \Magento\Downloadable\Model\Sample $sampleModel * @param \Magento\Backend\Model\UrlFactory $urlFactory * @param array $data */ public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\MediaStorage\Helper\File\Storage\Database $coreFileStorageDatabase, \Magento\Downloadable\Helper\File $downloadableFile, \Magento\Framework\Registry $coreRegistry, \Magento\Downloadable\Model\Sample $sampleModel, \Magento\Backend\Model\UrlFactory $urlFactory, array $data = []) { $this->_jsonEncoder = $jsonEncoder; $this->_coreFileStorageDb = $coreFileStorageDatabase; $this->_downloadableFile = $downloadableFile; $this->_coreRegistry = $coreRegistry; $this->_sampleModel = $sampleModel; $this->_urlFactory = $urlFactory; parent::__construct($context, $data); }
/** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Config\Model\Config\Structure $configStructure * @param \Magento\Backend\Helper\Data $backendHelper * @param array $data */ public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Config\Model\Config\Structure $configStructure, \Magento\Backend\Helper\Data $backendHelper, array $data = []) { $this->_backendHelper = $backendHelper; parent::__construct($context, $data); $this->_tabs = $configStructure->getTabs(); $this->setId('system_config_tabs'); $this->setTitle(__('Configuration')); $this->_currentSectionId = $this->getRequest()->getParam('section'); $this->_backendHelper->addPageHelpUrl($this->getRequest()->getParam('section') . '/'); }
/** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\CatalogInventory\Model\Source\Backorders $backorders * @param \Magento\CatalogInventory\Model\Source\Stock $stock * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Framework\Registry $coreRegistry * @param \Magento\CatalogInventory\Service\V1\StockItemService $stockItemService * @param \Magento\Catalog\Helper\Product\Inventory $inventoryHelper * @param array $data */ public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\CatalogInventory\Model\Source\Backorders $backorders, \Magento\CatalogInventory\Model\Source\Stock $stock, \Magento\Catalog\Helper\Data $catalogData, \Magento\Framework\Registry $coreRegistry, \Magento\CatalogInventory\Service\V1\StockItemService $stockItemService, \Magento\Catalog\Helper\Product\Inventory $inventoryHelper, array $data = array()) { $this->stock = $stock; $this->backorders = $backorders; $this->catalogData = $catalogData; $this->coreRegistry = $coreRegistry; $this->stockItemService = $stockItemService; $this->inventoryHelper = $inventoryHelper; parent::__construct($context, $data); }
/** * @return void */ protected function _construct() { parent::_construct(); $this->setErrorText($this->escapeJsQuote(__('Please select items.'))); if (null !== $this->getOptions()) { foreach ($this->getOptions() as $optionId => $option) { $this->addItem($optionId, $option); } $this->unsetData('options'); } }
public function __construct(\Ess\M2ePro\Block\Adminhtml\Magento\Context\Template $context, array $data = []) { $this->helperFactory = $context->getHelperFactory(); $this->modelFactory = $context->getModelFactory(); $this->activeRecordFactory = $context->getActiveRecordFactory(); $this->parentFactory = $context->getParentFactory(); $this->css = $context->getCss(); $this->jsPhp = $context->getJsPhp(); $this->js = $context->getJs(); $this->jsTranslator = $context->getJsTranslator(); $this->jsUrl = $context->getJsUrl(); parent::__construct($context, $data); }
/** * Prepare html output * * @return string */ protected function _toHtml() { if (!$this->getWidgetTemplates()) { $html = '<p class="nm"><small>' . __('Please Select Container First') . '</small></p>'; } elseif (count($this->getWidgetTemplates()) == 1) { $widgetTemplate = current($this->getWidgetTemplates()); $html = '<input type="hidden" name="template" value="' . $widgetTemplate['value'] . '" />'; $html .= $widgetTemplate['label']; } else { $html = $this->getLayout()->createBlock('Magento\\Framework\\View\\Element\\Html\\Select')->setName('template')->setClass('select')->setOptions($this->getWidgetTemplates())->setValue($this->getSelected())->toHtml(); } return parent::_toHtml() . $html; }
/** * Prepare layout object * * @return \Magento\Framework\View\Element\AbstractBlock */ protected function _prepareLayout() { /** @var $section \Magento\Backend\Model\Config\Structure\Element\Section */ $section = $this->_configStructure->getElement($this->getRequest()->getParam('section')); $this->_formBlockName = $section->getFrontendModel(); if (empty($this->_formBlockName)) { $this->_formBlockName = self::DEFAULT_SECTION_BLOCK; } $this->setTitle($section->getLabel()); $this->setHeaderCss($section->getHeaderCss()); $this->getToolbar()->addChild('save_button', 'Magento\\Backend\\Block\\Widget\\Button', array('id' => 'save', 'label' => __('Save Config'), 'class' => 'save primary', 'data_attribute' => array('mage-init' => array('button' => array('event' => 'save', 'target' => '#config-edit-form'))))); $block = $this->getLayout()->createBlock($this->_formBlockName); $this->setChild('form', $block); return parent::_prepareLayout(); }
/** * Preparing block layout * * @return $this * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ protected function _prepareLayout() { // Load Wysiwyg on demand and Prepare layout // $block = $this->getLayout()->getBlock('head'); // if ($this->_wysiwygConfig->isEnabled() && $block) { // $block->setCanLoadTinyMce(true); // } $this->getToolbar()->addChild('back_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Back'), 'onclick' => "window.location.href = '" . $this->getUrl('*/*') . "'", 'class' => 'action-back']); $this->getToolbar()->addChild('reset_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Reset'), 'onclick' => 'window.location.href = window.location.href', 'class' => 'reset']); if (!$this->isTextType()) { $this->getToolbar()->addChild('to_plain_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Convert to Plain Text'), 'data_attribute' => ['role' => 'template-strip'], 'id' => 'convert_button', 'class' => 'convert']); $this->getToolbar()->addChild('to_html_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Return HTML Version'), 'data_attribute' => ['role' => 'template-unstrip'], 'id' => 'convert_button_back', 'style' => 'display:none', 'class' => 'return']); } $this->getToolbar()->addChild('preview_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Preview Template'), 'data_attribute' => ['role' => 'template-preview'], 'class' => 'preview']); if ($this->getEditMode()) { $this->getToolbar()->addChild('delete_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Delete Template'), 'data_attribute' => ['role' => 'template-delete'], 'class' => 'delete']); $this->getToolbar()->addChild('save_as_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Save As'), 'data_attribute' => ['role' => 'template-save-as'], 'class' => 'save-as']); } $this->getToolbar()->addChild('save_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Save Template'), 'data_attribute' => ['role' => 'template-save'], 'class' => 'save primary']); return parent::_prepareLayout(); }
/** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Framework\Filter\Input\MaliciousCode $maliciousCode * @param \Magento\Email\Model\TemplateFactory $emailFactory * @param array $data */ public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Framework\Filter\Input\MaliciousCode $maliciousCode, \Magento\Email\Model\TemplateFactory $emailFactory, array $data = []) { $this->_maliciousCode = $maliciousCode; $this->_emailFactory = $emailFactory; parent::__construct($context, $data); }
/** * Prepare block layout * * @return $this */ protected function _prepareLayout() { $this->addChild('selection_delete_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Delete'), 'class' => 'delete icon-btn', 'on_click' => 'bSelection.remove(event)']); return parent::_prepareLayout(); }
/** * Render block HTML * * @return string */ protected function _toHtml() { $accordion = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Widget\\Accordion')->setId($this->accordionBlockId); $accordion->addItem('samples', ['title' => __('Samples'), 'content' => $this->getLayout()->createBlock('Magento\\Downloadable\\Block\\Adminhtml\\Catalog\\Product\\Edit\\Tab\\Downloadable\\Samples')->toHtml(), 'open' => false]); $accordion->addItem('links', ['title' => __('Links'), 'content' => $this->getLayout()->createBlock('Magento\\Downloadable\\Block\\Adminhtml\\Catalog\\Product\\Edit\\Tab\\Downloadable\\Links', 'catalog.product.edit.tab.downloadable.links')->toHtml(), 'open' => true]); $this->setChild('accordion', $accordion); return parent::_toHtml(); }
/** * @return $this */ protected function _prepareLayout() { $this->addChild('add_selection_button', 'Magento\\Backend\\Block\\Widget\\Button', array('id' => $this->getFieldId() . '_{{index}}_add_button', 'label' => __('Add Products to Option'), 'class' => 'add add-selection')); $this->addChild('close_search_button', 'Magento\\Backend\\Block\\Widget\\Button', array('id' => $this->getFieldId() . '_{{index}}_close_button', 'label' => __('Close'), 'on_click' => 'bSelection.closeSearch(event)', 'class' => 'back no-display')); $this->addChild('option_delete_button', 'Magento\\Backend\\Block\\Widget\\Button', array('label' => __('Delete Option'), 'class' => 'action-delete', 'on_click' => 'bOption.remove(event)')); $this->addChild('selection_template', 'Magento\\Bundle\\Block\\Adminhtml\\Catalog\\Product\\Edit\\Tab\\Bundle\\Option\\Selection'); return parent::_prepareLayout(); }
/** * Prepare search grid * * @return $this */ protected function _beforeToHtml() { $this->getChildBlock('grid')->setIndex($this->getIndex())->setFirstShow($this->getFirstShow()); return parent::_beforeToHtml(); }
/** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Sales\Helper\Admin $adminHelper * @param array $data */ public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\Sales\Helper\Admin $adminHelper, array $data = []) { $this->_adminHelper = $adminHelper; $this->_coreRegistry = $registry; parent::__construct($context, $data); }
/** * Prepares layout and set element renderer * * @return $this */ protected function _prepareLayout() { $this->pageConfig->addPageAsset('jquery/fileUploader/css/jquery.fileupload-ui.css'); return parent::_prepareLayout(); }
/** * Define block template * * @return void */ protected function _construct() { $this->setTemplate('Magento_Backend::widget/button.phtml'); parent::_construct(); }