本文整理汇总了PHP中Magento\Backend\Block\Template::_prepareLayout方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::_prepareLayout方法的具体用法?PHP Template::_prepareLayout怎么用?PHP Template::_prepareLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Backend\Block\Template
的用法示例。
在下文中一共展示了Template::_prepareLayout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareLayout
/**
* @return AbstractBlock|void
*/
protected function _prepareLayout()
{
parent::_prepareLayout();
$this->getToolbar()->addChild('createSnapshotButton', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('System Backup'), 'onclick' => "return backup.backup('" . \Magento\Framework\Backup\Factory::TYPE_SYSTEM_SNAPSHOT . "')", 'class' => 'primary system-backup']);
$this->getToolbar()->addChild('createMediaBackupButton', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Database and Media Backup'), 'onclick' => "return backup.backup('" . \Magento\Framework\Backup\Factory::TYPE_MEDIA . "')", 'class' => 'primary database-media-backup']);
$this->getToolbar()->addChild('createButton', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Database Backup'), 'onclick' => "return backup.backup('" . \Magento\Framework\Backup\Factory::TYPE_DB . "')", 'class' => 'task primary database-backup']);
$this->addChild('dialogs', 'Magento\\Backup\\Block\\Adminhtml\\Dialogs');
}
示例2: _prepareLayout
/**
* @return AbstractBlock
*/
protected function _prepareLayout()
{
if ($this->getToolbar()) {
$this->getToolbar()->addChild('save_button', 'Magento\\Backend\\Block\\Widget\\Button', array('label' => __('Save Attribute Set'), 'class' => 'save primary save-attribute-set', 'data_attribute' => array('mage-init' => array('button' => array('event' => 'save', 'target' => '#set-prop-form')))));
$this->getToolbar()->addChild('back_button', 'Magento\\Backend\\Block\\Widget\\Button', array('label' => __('Back'), 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/') . '\')', 'class' => 'back'));
}
$this->addChild('setForm', 'Magento\\Catalog\\Block\\Adminhtml\\Product\\Attribute\\Set\\Main\\Formset');
return parent::_prepareLayout();
}
示例3: _prepareLayout
/**
* @return AbstractBlock|void
*/
protected function _prepareLayout()
{
parent::_prepareLayout();
$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']);
$this->getToolbar()->addChild('save_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Generate Module'), 'class' => 'save primary create-module', 'data_attribute' => ['mage-init' => ['button' => ['event' => 'save', 'target' => '#module-creator-form']]]]);
}
示例4: _prepareLayout
/**
* {@inheritdoc}
*/
protected function _prepareLayout()
{
$this->setTemplate('Magento_Backend::system/design/index.phtml');
$this->getToolbar()->addChild('add_new_button', 'Magento\\Backend\\Block\\Widget\\Button', array('label' => __('Add Design Change'), 'onclick' => "setLocation('" . $this->getUrl('adminhtml/*/new') . "')", 'class' => 'add primary add-design-change'));
$this->getLayout()->getBlock('page-title')->setPageTitle('Store Design Schedule');
return parent::_prepareLayout();
}
示例5: _prepareLayout
/**
* Preparing global layout
*
* @return $this
*/
protected function _prepareLayout()
{
$onclick = "submitAndReloadArea(\$('order_history_block').parentNode, '" . $this->getSubmitUrl() . "')";
$button = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Widget\\Button')->setData(['label' => __('Submit Comment'), 'class' => 'action-save action-secondary', 'onclick' => $onclick]);
$this->setChild('submit_button', $button);
return parent::_prepareLayout();
}
示例6: _prepareLayout
/**
* Prepare layout
*
* @return \Magento\Framework\View\Element\AbstractBlock
*/
protected function _prepareLayout()
{
$this->getToolbar()->addChild('save_button', 'Magento\\Backend\\Block\\Widget\\Button', array('label' => __('Save Currency Rates'), 'class' => 'save primary save-currency-rates', 'data_attribute' => array('mage-init' => array('button' => array('event' => 'save', 'target' => '#rate-form')))));
$this->getToolbar()->addChild('reset_button', 'Magento\\Backend\\Block\\Widget\\Button', array('label' => __('Reset'), 'onclick' => 'document.location.reload()', 'class' => 'reset'));
$this->addChild('import_button', 'Magento\\Backend\\Block\\Widget\\Button', array('label' => __('Import'), 'class' => 'add', 'type' => 'submit'));
$this->addChild('rates_matrix', 'Magento\\CurrencySymbol\\Block\\Adminhtml\\System\\Currency\\Rate\\Matrix');
$this->addChild('import_services', 'Magento\\CurrencySymbol\\Block\\Adminhtml\\System\\Currency\\Rate\\Services');
return parent::_prepareLayout();
}
示例7: _prepareLayout
/**
* @return $this
*/
protected function _prepareLayout()
{
$this->getToolbar()->addChild('backButton', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Back'), 'onclick' => 'window.location.href=\'' . $this->getUrl('*/*/') . '\'', 'class' => 'back']);
$this->getToolbar()->addChild('resetButton', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Reset'), 'onclick' => 'window.location.reload()', 'class' => 'reset']);
if (intval($this->getRequest()->getParam('rid'))) {
$this->getToolbar()->addChild('deleteButton', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Delete Role'), 'onclick' => 'deleteConfirm(\'' . __('Are you sure you want to do this?') . '\', \'' . $this->getUrl('*/*/delete', ['rid' => $this->getRequest()->getParam('rid')]) . '\')', 'class' => 'delete']);
}
$this->getToolbar()->addChild('saveButton', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Save Role'), 'class' => 'save primary save-role', 'data_attribute' => ['mage-init' => ['button' => ['event' => 'save', 'target' => '#role-edit-form']]]]);
return parent::_prepareLayout();
}
示例8: _prepareLayout
/**
* {@inheritdoc}
*/
protected function _prepareLayout()
{
$itemId = $this->getRequest()->getParam('group_id');
$this->setTemplate('system/store/delete_group.phtml');
$this->setAction($this->getUrl('adminhtml/*/deleteGroupPost', ['group_id' => $itemId]));
$this->addChild('confirm_deletion_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Delete Store'), 'onclick' => "deleteForm.submit()", 'class' => 'cancel']);
$onClick = "setLocation('" . $this->getUrl('adminhtml/*/editGroup', ['group_id' => $itemId]) . "')";
$this->addChild('cancel_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Cancel'), 'onclick' => $onClick, 'class' => 'cancel']);
$this->addChild('back_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Back'), 'onclick' => $onClick, 'class' => 'cancel']);
return parent::_prepareLayout();
}
示例9: _prepareLayout
/**
* Prepare layout
*
* @return \Magento\Framework\View\Element\AbstractBlock
*/
protected function _prepareLayout()
{
$this->getToolbar()->addChild('save_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Save Currency Rates'), 'class' => 'save primary save-currency-rates', 'data_attribute' => ['mage-init' => ['button' => ['event' => 'save', 'target' => '#rate-form']]]]);
$onClick = "setLocation('" . $this->getUrl('adminhtml/system_config/edit/section/currency') . "')";
$this->getToolbar()->addChild('options_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Options'), 'onclick' => $onClick]);
$this->getToolbar()->addChild('reset_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Reset'), 'onclick' => 'document.location.reload()', 'class' => 'reset']);
$this->addChild('import_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Import'), 'class' => 'add', 'type' => 'submit']);
$this->addChild('rates_matrix', 'Magento\\CurrencySymbol\\Block\\Adminhtml\\System\\Currency\\Rate\\Matrix');
$this->addChild('import_services', 'Magento\\CurrencySymbol\\Block\\Adminhtml\\System\\Currency\\Rate\\Services');
return parent::_prepareLayout();
}
示例10: _prepareLayout
/**
* @return void
*/
protected function _prepareLayout()
{
$this->addChild('lastOrders', 'Magento\\Backend\\Block\\Dashboard\\Orders\\Grid');
$this->addChild('totals', 'Magento\\Backend\\Block\\Dashboard\\Totals');
$this->addChild('sales', 'Magento\\Backend\\Block\\Dashboard\\Sales');
if ($this->_scopeConfig->getValue(self::XML_PATH_ENABLE_CHARTS, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) {
$block = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Dashboard\\Diagrams');
} else {
$block = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Template')->setTemplate('dashboard/graph/disabled.phtml')->setConfigUrl($this->getUrl('adminhtml/system_config/edit', ['section' => 'admin']));
}
$this->setChild('diagrams', $block);
$this->addChild('grids', 'Magento\\Backend\\Block\\Dashboard\\Grids');
parent::_prepareLayout();
}
示例11: _prepareLayout
/**
* Add shopping cart grid of each website
*
* @return $this
*/
protected function _prepareLayout()
{
$sharedWebsiteIds = $this->_shareConfig->getSharedWebsiteIds($this->_getCustomer()->getWebsiteId());
$isShared = count($sharedWebsiteIds) > 1;
foreach ($sharedWebsiteIds as $websiteId) {
$blockName = 'customer_cart_' . $websiteId;
$block = $this->getLayout()->createBlock('Magento\\Customer\\Block\\Adminhtml\\Edit\\Tab\\Cart', $blockName, ['data' => ['website_id' => $websiteId]]);
if ($isShared) {
$websiteName = $this->_storeManager->getWebsite($websiteId)->getName();
$block->setCartHeader(__('Shopping Cart from %1', $websiteName));
}
$this->setChild($blockName, $block);
}
return parent::_prepareLayout();
}
示例12: _prepareLayout
/**
* Prepare Global Layout
*
* @return $this
*/
protected function _prepareLayout()
{
$setId = $this->_getSetId();
$this->addChild('group_tree', 'Magento\\Catalog\\Block\\Adminhtml\\Product\\Attribute\\Set\\Main\\Tree\\Group');
$this->addChild('edit_set_form', 'Magento\\Catalog\\Block\\Adminhtml\\Product\\Attribute\\Set\\Main\\Formset');
$this->addChild('delete_group_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Delete Selected Group'), 'onclick' => 'editSet.submit();', 'class' => 'delete']);
$this->addChild('add_group_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Add New'), 'onclick' => 'editSet.addGroup();', 'class' => 'add']);
$this->getToolbar()->addChild('back_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Back'), 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/') . '\')', 'class' => 'back']);
$this->getToolbar()->addChild('reset_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Reset'), 'onclick' => 'window.location.reload()', 'class' => 'reset']);
if (!$this->getIsCurrentSetDefault()) {
$this->getToolbar()->addChild('delete_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Delete'), 'onclick' => 'deleteConfirm(\'' . $this->escapeJsQuote(__('You are about to delete all products in this attribute set. ' . 'Are you sure you want to do that?')) . '\', \'' . $this->getUrl('catalog/*/delete', ['id' => $setId]) . '\')', 'class' => 'delete']);
}
$this->getToolbar()->addChild('save_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Save'), 'onclick' => 'editSet.save();', 'class' => 'save primary save-attribute-set']);
$this->addChild('rename_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('New Set Name'), 'onclick' => 'editSet.rename()']);
return parent::_prepareLayout();
}
示例13: _prepareLayout
/**
* Prepare layout
*
* @return \Magento\Framework\View\Element\AbstractBlock
*/
protected function _prepareLayout()
{
$newRates = $this->_backendSession->getRates();
$this->_backendSession->unsetData('rates');
$currencyModel = $this->_dirCurrencyFactory->create();
$currencies = $currencyModel->getConfigAllowCurrencies();
$defaultCurrencies = $currencyModel->getConfigBaseCurrencies();
$oldCurrencies = $this->_prepareRates($currencyModel->getCurrencyRates($defaultCurrencies, $currencies));
foreach ($currencies as $currency) {
foreach ($oldCurrencies as $key => $value) {
if (!array_key_exists($currency, $oldCurrencies[$key])) {
$oldCurrencies[$key][$currency] = '';
}
}
}
foreach ($oldCurrencies as $key => $value) {
ksort($oldCurrencies[$key]);
}
sort($currencies);
$this->setAllowedCurrencies($currencies)->setDefaultCurrencies($defaultCurrencies)->setOldRates($oldCurrencies)->setNewRates($this->_prepareRates($newRates));
return parent::_prepareLayout();
}
示例14: _prepareLayout
/**
* @return $this
*/
protected function _prepareLayout()
{
$this->buttonList->add('back', ['label' => __('Back'), 'onclick' => 'window.location.href=\'' . $this->getUrl('tax/*/') . '\'', 'class' => 'back']);
$this->buttonList->add('reset', ['label' => __('Reset'), 'onclick' => 'window.location.reload()', 'class' => 'reset']);
$rate = intval($this->getRequest()->getParam('rate'));
if ($rate) {
$this->buttonList->add('delete', ['label' => __('Delete Rate'), 'onclick' => 'deleteConfirm(\'' . __('Are you sure you want to do this?') . '\', \'' . $this->getUrl('tax/*/delete', ['rate' => $rate]) . '\')', 'class' => 'delete']);
}
$this->buttonList->add('save', ['label' => __('Save Rate'), 'class' => 'save primary save-rate', 'data_attribute' => ['mage-init' => ['button' => ['event' => 'save', 'target' => '#rate-form']]]]);
$this->toolbar->pushButtons($this, $this->buttonList);
return parent::_prepareLayout();
}
示例15: _prepareLayout
/**
* {@inheritdoc}
*/
protected function _prepareLayout()
{
$this->addChild('delete_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Delete'), 'onclick' => "deleteImage(#image#)", 'class' => 'delete']);
$this->addChild('add_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Add New Image'), 'onclick' => 'addNewImage()', 'class' => 'add']);
return parent::_prepareLayout();
}