/** * Preparing global layout * * You can redefine this method in child classes for changing layout * * @return $this */ protected function _prepareLayout() { \Magento\Framework\Data\Form::setElementRenderer($this->getLayout()->createBlock('Magento\\Backend\\Block\\Widget\\Form\\Renderer\\Element', $this->getNameInLayout() . '_element')); \Magento\Framework\Data\Form::setFieldsetRenderer($this->getLayout()->createBlock('Magento\\Backend\\Block\\Widget\\Form\\Renderer\\Fieldset', $this->getNameInLayout() . '_fieldset')); \Magento\Framework\Data\Form::setFieldsetElementRenderer($this->getLayout()->createBlock('Magento\\Backend\\Block\\Widget\\Form\\Renderer\\Fieldset\\Element', $this->getNameInLayout() . '_fieldset_element')); return parent::_prepareLayout(); }
/** * 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(); }
/** * @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(); }
/** * {@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(); }
/** * 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(); }
/** * Create search grid * * @return $this */ protected function _prepareLayout() { $this->setChild('grid', $this->getLayout()->createBlock('Magento\\Bundle\\Block\\Adminhtml\\Catalog\\Product\\Edit\\Tab\\Bundle\\Option\\Search\\Grid', 'adminhtml.catalog.product.edit.tab.bundle.option.search.grid')); return parent::_prepareLayout(); }
/** * Prepare Layout data * * @return $this */ protected function _prepareLayout() { $this->addChild('create_empty', 'Magento\\Backend\\Block\\Widget\\Button', array('label' => __('Create Empty'), 'class' => 'add', 'onclick' => 'superProduct.createEmptyProduct()')); $this->addChild('super_settings', 'Magento\\ConfigurableProduct\\Block\\Adminhtml\\Product\\Edit\\Tab\\Super\\Settings'); $this->addChild('generate', 'Magento\\Backend\\Block\\Widget\\Button', array('label' => __('Generate Variations'), 'class' => 'generate', 'data_attribute' => array('mage-init' => array('button' => array('event' => 'generate', 'target' => '#product-variations-matrix', 'eventData' => array('url' => $this->getUrl('catalog/product_generateVariations/index', array('_current' => true))))), 'action' => 'generate'))); $this->addChild('add_attribute', 'Magento\\Backend\\Block\\Widget\\Button', array('label' => __('Create New Variation Set'), 'class' => 'new-variation-set', 'data_attribute' => array('mage-init' => array('configurableAttribute' => array('url' => $this->getUrl('catalog/product_attribute/new', array('store' => $this->getProduct()->getStoreId(), 'product_tab' => 'variations', 'popup' => 1, '_query' => array('attribute' => array('is_global' => 1, 'frontend_input' => 'select', 'is_configurable' => 1))))))))); $this->addChild('add_option', 'Magento\\Backend\\Block\\Widget\\Button', array('label' => __('Add Option'), 'class' => 'action- scalable add', 'data_attribute' => array('mage-init' => array('button' => array('event' => 'add-option')), 'action' => 'add-option'))); return parent::_prepareLayout(); }
/** * Prepares layout and set element renderer * * @return $this */ protected function _prepareLayout() { $this->pageConfig->addPageAsset('jquery/fileUploader/css/jquery.fileupload-ui.css'); return parent::_prepareLayout(); }
/** * @return $this */ protected function _prepareLayout() { $this->setData('opened', $this->isDownloadable()); return parent::_prepareLayout(); }
/** * @return $this */ protected function _prepareLayout() { $this->setChild('option_price_type', $this->getLayout()->addBlock('Magento\\Framework\\View\\Element\\Html\\Select', $this->getNameInLayout() . '.option_price_type', $this->getNameInLayout())->setData(['id' => 'product_option_<%- data.option_id %>_price_type', 'class' => 'select product-option-price-type'])); $this->getChildBlock('option_price_type')->setName('product[options][<%- data.option_id %>][price_type]')->setOptions($this->_optionPrice->toOptionArray()); return parent::_prepareLayout(); }
/** * @return $this */ protected function _prepareLayout() { $this->_prepareData(); return parent::_prepareLayout(); }
/** * Prepares layout and set element renderer * * @return $this */ protected function _prepareLayout() { $head = $this->getLayout()->getBlock('head'); if ($head) { $head->addChild('jquery-fileUploader-css-jquery-fileupload-ui-css', 'Magento\\Theme\\Block\\Html\\Head\\Css', array('file' => 'jquery/fileUploader/css/jquery.fileupload-ui.css')); } return parent::_prepareLayout(); }
/** * Add elements in layout * * @return $this */ protected function _prepareLayout() { if (!$this->getRequest()->getParam('popup')) { if ($this->getToolbar()) { $this->getToolbar()->addChild('back_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Back'), 'title' => __('Back'), 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/', ['store' => $this->getRequest()->getParam('store', 0)]) . '\')', 'class' => 'action-back']); } } else { $this->addChild('back_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Close Window'), 'onclick' => 'window.close()', 'class' => 'cancel']); } if (!$this->getProduct()->isReadonly()) { $this->addChild('reset_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Reset'), 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/*', ['_current' => true]) . '\')']); } if (!$this->getProduct()->isReadonly() && $this->getToolbar()) { $this->getToolbar()->addChild('save-split-button', 'Magento\\Backend\\Block\\Widget\\Button\\SplitButton', ['id' => 'save-split-button', 'label' => __('Save'), 'class_name' => 'Magento\\Backend\\Block\\Widget\\Button\\SplitButton', 'button_class' => 'widget-button-save', 'options' => $this->_getSaveSplitButtonOptions()]); } return parent::_prepareLayout(); }
/** * @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(); }
/** * @return $this */ protected function _prepareLayout() { foreach ($this->_productOptionConfig->getAll() as $option) { $this->addChild($option['name'] . '_option_type', $option['renderer']); } return parent::_prepareLayout(); }
/** * Prepare export button * * @return $this */ protected function _prepareLayout() { $this->setChild('export_button', $this->getLayout()->createBlock('Magento\\Backend\\Block\\Widget\\Button')->setData(array('label' => __('Export'), 'onclick' => $this->getParentBlock()->getJsObjectName() . '.doExport()', 'class' => 'task'))); return parent::_prepareLayout(); }
/** * @return $this */ protected function _prepareLayout() { $this->setData('opened', $this->getProduct()->getTypeId() === Configurable::TYPE_CODE); return parent::_prepareLayout(); }
/** * @return $this */ protected function _prepareLayout() { $this->setData('opened', $this->isConfigurableProduct()); return parent::_prepareLayout(); }
/** * {@inheritdoc} */ protected function _prepareLayout() { $this->addChild('save_button', 'Magento\\Backend\\Block\\Widget\\Button', array('label' => __('Save Cache Settings'), 'class' => 'save', 'data_attribute' => array('mage-init' => array('button' => array('event' => 'save', 'target' => '#config-edit-form'))))); return parent::_prepareLayout(); }
/** * Prepare layout * * @return $this * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ protected function _prepareLayout() { $this->buttonList->add('back', ['label' => __('Back'), 'onclick' => "window.location.href = '" . $this->getUrl('adminhtml/*') . "'", 'class' => 'back']); $this->buttonList->add('reset', ['label' => __('Reset'), 'onclick' => 'window.location.href = window.location.href']); if ($this->getEditMode()) { $this->buttonList->add('delete', ['label' => __('Delete Template'), 'data_attribute' => ['role' => 'template-delete'], 'class' => 'delete']); } if (!$this->isTextType()) { $this->buttonList->add('to_plain', ['label' => __('Convert to Plain Text'), 'data_attribute' => ['role' => 'template-strip'], 'id' => 'convert_button']); $this->buttonList->add('to_html', ['label' => __('Return Html Version'), 'data_attribute' => ['role' => 'template-unstrip'], 'id' => 'convert_button_back', 'style' => 'display:none']); } $this->buttonList->add('preview', ['label' => __('Preview Template'), 'data_attribute' => ['role' => 'template-preview']]); $this->buttonList->add('save', ['label' => __('Save Template'), 'data_attribute' => ['role' => 'template-save'], 'class' => 'save primary save-template']); $this->buttonList->add('load', ['label' => __('Load Template'), 'data_attribute' => ['role' => 'template-load'], 'type' => 'button', 'class' => 'save'], 0, 0, null); $this->toolbar->pushButtons($this, $this->buttonList); $this->addChild('form', 'Magento\\Email\\Block\\Adminhtml\\Template\\Edit\\Form'); return parent::_prepareLayout(); }
/** * 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(); }
/** * {@inheritdoc} */ protected function _prepareLayout() { $this->addChild('add_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Add Tax'), 'data_attribute' => ['action' => 'add-fpt-item'], 'class' => 'add']); $this->addChild('delete_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Delete Tax'), 'data_attribute' => ['action' => 'delete-fpt-item'], 'class' => 'delete']); return parent::_prepareLayout(); }