本文整理匯總了PHP中Magento\Backend\Block\Widget\Form\Container類的典型用法代碼示例。如果您正苦於以下問題:PHP Container類的具體用法?PHP Container怎麽用?PHP Container使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Container類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _construct
protected function _construct()
{
$this->_objectId = 'api_key';
$this->_blockGroup = 'Expressly_Expressly';
$this->_controller = 'expressly_dashboard';
parent::_construct();
}
示例2: _construct
/**
* Prepare block
*/
public function _construct()
{
parent::_construct();
$this->_blockGroup = 'Remarkety_Mgconnector';
$this->_controller = 'adminhtml_queue';
$this->_headerText = $this->__('Queue Configuration');
}
示例3: _construct
/**
* Initialize cadou edit block
*
* @return void
*/
protected function _construct()
{
$this->_objectId = 'cadou_id';
$this->_blockGroup = 'Alin_Cadou';
$this->_controller = 'adminhtml_cadou';
parent::_construct();
if ($this->_isAllowedAction('Alin_Cadou::save')) {
$this->buttonList->update('save', 'label', __('Save'));
$this->buttonList->add('saveandcontinue', ['label' => __('Save and Continue Edit'), 'class' => 'save', 'data_attribute' => ['mage-init' => ['button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form']]]], -100);
} else {
$this->buttonList->remove('save');
}
if ($this->_isAllowedAction('Alin_Cadou::delete')) {
$this->buttonList->update('delete', 'label', __('Delete'));
} else {
$this->buttonList->remove('delete');
}
//TODO: see how to add /handle new event
if ($this->_isAllowedAction('Alin_Cadou::notify')) {
if ($this->_coreRegistry->registry('cadou')->getNotified() == false) {
$this->buttonList->add('notify', ['label' => __('Send notification'), 'class' => 'notify'], -100);
}
} else {
$this->buttonList->remove('notify');
}
}
示例4: _construct
/**
* _construct
* @return void
*/
protected function _construct()
{
$this->_objectId = 'banner_id';
$this->_blockGroup = 'Magestore_Bannerslider';
$this->_controller = 'adminhtml_banner';
parent::_construct();
$this->buttonList->update('save', 'label', __('Save Banner'));
$this->buttonList->update('delete', 'label', __('Delete'));
if ($this->getRequest()->getParam('current_slider_id')) {
$this->buttonList->remove('save');
$this->buttonList->remove('delete');
$this->buttonList->remove('back');
$this->buttonList->add('close_window', ['label' => __('Close Window'), 'onclick' => 'window.close();'], 10);
$this->buttonList->add('save_and_continue', ['label' => __('Save and Continue Edit'), 'class' => 'save', 'onclick' => 'customsaveAndContinueEdit()'], 10);
$this->buttonList->add('save_and_close', ['label' => __('Save and Close'), 'class' => 'save_and_close', 'onclick' => 'saveAndCloseWindow()'], 10);
$this->_formScripts[] = "\n\t\t\t\trequire(['jquery'], function(\$){\n\t\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\tvar input = \$('<input class=\"custom-button-submit\" type=\"submit\" hidden=\"true\" />');\n\t\t\t\t\t\t\$(edit_form).append(input);\n\n\t\t\t\t\t\twindow.customsaveAndContinueEdit = function (){\n\t\t\t\t\t\t\tedit_form.action = '" . $this->getSaveAndContinueUrl() . "';\n\t\t\t\t\t\t\t\$('.custom-button-submit').trigger('click');\n\n\t\t\t\t }\n\n\t\t\t \t\twindow.saveAndCloseWindow = function (){\n\t\t\t \t\t\tedit_form.action = '" . $this->getSaveAndCloseWindowUrl() . "';\n\t\t\t\t\t\t\t\$('.custom-button-submit').trigger('click');\n\t\t\t }\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t";
if ($bannerId = $this->getRequest()->getParam('banner_id')) {
$this->_formScripts[] = '
window.banner_id = ' . $bannerId . ';
';
}
} else {
$this->buttonList->add('save_and_continue', ['label' => __('Save and Continue Edit'), 'class' => 'save', 'data_attribute' => ['mage-init' => ['button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form']]]], 10);
}
if ($this->getRequest()->getParam('saveandclose')) {
$this->_formScripts[] = 'window.close();';
}
}
示例5: _construct
protected function _construct()
{
$this->_objectId = 'slider_id';
$this->_blockGroup = 'Magestore_Bannerslider';
$this->_controller = 'adminhtml_slider';
parent::_construct();
$this->buttonList->update('save', 'label', __('Save Slider'));
$this->buttonList->update('delete', 'label', __('Delete'));
if ($this->getSlider()->getId()) {
$this->buttonList->add('create_banner', ['label' => __('Create Banner'), 'class' => 'add', 'onclick' => 'openBannerPopupWindow(\'' . $this->getCreateBannerUrl() . '\')'], 1);
}
$this->buttonList->add('save_and_continue', ['label' => __('Save and Continue Edit'), 'class' => 'save', 'data_attribute' => ['mage-init' => ['button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form']]]], 10);
/*
* Note by: Nguyen Huu Tien (Email: tien.uet.qh2011@gmail.com, Skype : zerokool12a8)
* javascript variable
* create_banner_popupwindow : window popup
* create_banner_popupwindow.banner_id : Id of banner after creating in popup
* bannerGridJsObject : grid object
* bannerGridJsObject.reloadParams['banner[]'] : An array contain Ids of banners, ex. Array [ "2", "30", "31", "32", .. ]
* edit_form: form
* edit_form.slider_banner: input for serialization
*
* See more at file magento2root/lib/web/mage/adminhtml/grid.js
*/
$this->_formScripts[] = "\n\t\t\trequire(['jquery'], function(\$){\n\t\t\t\twindow.openBannerPopupWindow = function (url) {\n\t\t\t\t\tvar left = (\$(document).width()-1000)/2, height= \$(document).height();\n\t\t\t\t\tvar create_banner_popupwindow = window.open(url, '_blank','width=1000,resizable=1,scrollbars=1,toolbar=1,'+'left='+left+',height='+height);\n\t\t\t\t\tvar windowFocusHandle = function(){\n\t\t\t\t\t\tif (create_banner_popupwindow.closed) {\n\t\t\t\t\t\t\tif (typeof bannerGridJsObject !== 'undefined' && create_banner_popupwindow.banner_id) {\n\t\t\t\t\t\t\t\tbannerGridJsObject.reloadParams['banner[]'].push(create_banner_popupwindow.banner_id + '');\n\t\t\t\t\t\t\t\t\$(edit_form.slider_banner).val(\$(edit_form.slider_banner).val() + '&' + create_banner_popupwindow.banner_id + '=' + Base64.encode('order_banner_slider=0'));\n\t\t\t\t \t\t\tbannerGridJsObject.setPage(create_banner_popupwindow.banner_id);\n\t\t\t\t \t\t}\n\t\t\t\t \t\t\$(window).off('focus',windowFocusHandle);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\$(create_banner_popupwindow).trigger('focus');\n\t\t\t\t\t\t\tcreate_banner_popupwindow.alert('" . __('You have to save banner and close this window!') . "');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\$(window).focus(windowFocusHandle);\n\t\t\t\t}\n\t\t\t});\n\t\t";
}
示例6: _construct
/**
* Add & remove control buttons
*
* @return void
*/
protected function _construct()
{
$this->_objectId = 'creditmemo_id';
$this->_controller = 'adminhtml_order_creditmemo';
$this->_mode = 'view';
parent::_construct();
$this->buttonList->remove('save');
$this->buttonList->remove('reset');
$this->buttonList->remove('delete');
if (!$this->getCreditmemo()) {
return;
}
if ($this->getCreditmemo()->canCancel()) {
$this->buttonList->add('cancel', ['label' => __('Cancel'), 'class' => 'delete', 'onclick' => 'setLocation(\'' . $this->getCancelUrl() . '\')']);
}
if ($this->_isAllowedAction('Magento_Sales::emails')) {
$this->addButton('send_notification', ['label' => __('Send Email'), 'class' => 'send-email', 'onclick' => 'confirmSetLocation(\'' . __('Are you sure you want to send a credit memo email to customer?') . '\', \'' . $this->getEmailUrl() . '\')']);
}
if ($this->getCreditmemo()->canRefund()) {
$this->buttonList->add('refund', ['label' => __('Refund'), 'class' => 'refund', 'onclick' => 'setLocation(\'' . $this->getRefundUrl() . '\')']);
}
if ($this->getCreditmemo()->canVoid()) {
$this->buttonList->add('void', ['label' => __('Void'), 'class' => 'void', 'onclick' => 'setLocation(\'' . $this->getVoidUrl() . '\')']);
}
if ($this->getCreditmemo()->getId()) {
$this->buttonList->add('print', ['label' => __('Print'), 'class' => 'print', 'onclick' => 'setLocation(\'' . $this->getPrintUrl() . '\')']);
}
}
示例7: _construct
/**
* Constructor
*
* @return void
*/
protected function _construct()
{
$this->_objectId = 'order_id';
$this->_controller = 'order';
$this->_mode = 'create';
parent::_construct();
$this->setId('sales_order_create');
$customerId = $this->_sessionQuote->getCustomerId();
$storeId = $this->_sessionQuote->getStoreId();
$this->buttonList->update('save', 'label', __('Submit Order'));
$this->buttonList->update('save', 'onclick', 'order.submit()');
$this->buttonList->update('save', 'class', 'primary');
// Temporary solution, unset button widget. Will have to wait till jQuery migration is complete
$this->buttonList->update('save', 'data_attribute', array());
$this->buttonList->update('save', 'id', 'submit_order_top_button');
if (is_null($customerId) || !$storeId) {
$this->buttonList->update('save', 'style', 'display:none');
}
$this->buttonList->update('back', 'id', 'back_order_top_button');
$this->buttonList->update('back', 'onclick', 'setLocation(\'' . $this->getBackUrl() . '\')');
$this->buttonList->update('reset', 'id', 'reset_order_top_button');
if (is_null($customerId)) {
$this->buttonList->update('reset', 'style', 'display:none');
} else {
$this->buttonList->update('back', 'style', 'display:none');
}
$confirm = __('Are you sure you want to cancel this order?');
$this->buttonList->update('reset', 'label', __('Cancel'));
$this->buttonList->update('reset', 'class', 'cancel');
$this->buttonList->update('reset', 'onclick', 'deleteConfirm(\'' . $confirm . '\', \'' . $this->getCancelUrl() . '\')');
$pageTitle = $this->getLayout()->createBlock('Magento\\Sales\\Block\\Adminhtml\\Order\\Create\\Header')->toHtml();
if (is_object($this->getLayout()->getBlock('page-title'))) {
$this->getLayout()->getBlock('page-title')->setPageTitle($pageTitle);
}
}
示例8: addButton
/**
* {@inheritdoc}
*/
public function addButton($buttonId, $data, $level = 0, $sortOrder = 0, $region = 'toolbar')
{
if ($this->getRequest()->getParam('popup')) {
$region = 'header';
}
parent::addButton($buttonId, $data, $level, $sortOrder, $region);
}
示例9: _prepareLayout
/**
* Prepare layout
*
* @return \Magento\Framework\View\Element\AbstractBlock
*/
protected function _prepareLayout()
{
$this->_blockGroup = 'Magento_Theme';
$this->_controller = 'Adminhtml_System_Design_Theme';
$this->setId('theme_edit');
if (is_object($this->getLayout()->getBlock('page.title'))) {
$this->getLayout()->getBlock('page.title')->setPageTitle($this->getHeaderText());
}
/** @var $theme \Magento\Framework\View\Design\ThemeInterface */
$theme = $this->_getCurrentTheme();
if ($theme) {
if ($theme->isEditable()) {
$this->buttonList->add('save_and_continue', ['label' => __('Save and Continue Edit'), 'class' => 'save', 'data_attribute' => ['mage-init' => ['button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form']]]], 1);
} else {
$this->buttonList->remove('save');
$this->buttonList->remove('reset');
}
if ($theme->isDeletable()) {
if ($theme->hasChildThemes()) {
$message = __('Are you sure you want to delete this theme?');
$onClick = sprintf("deleteConfirm('%s', '%s')", $message, $this->getUrl('adminhtml/*/delete', ['id' => $theme->getId()]));
$this->buttonList->update('delete', 'onclick', $onClick);
}
} else {
$this->buttonList->remove('delete');
}
}
return parent::_prepareLayout();
}
示例10: _prepareLayout
public function _prepareLayout()
{
$this->_blockGroup = 'Remarkety_Mgconnector';
$this->_controller = 'adminhtml_queue';
$this->_headerText = __('Remarkety Configuration');
$this->_nameInLayout = 'mgconnectorconfig';
return parent::_prepareLayout();
}
示例11: _construct
/**
* Internal constructor
*
* @return void
*/
protected function _construct()
{
parent::_construct();
$this->removeButton('back')->removeButton('reset')->removeButton('save');
$this->_objectId = 'export_id';
$this->_blockGroup = 'Magento_ImportExport';
$this->_controller = 'adminhtml_export';
}
示例12: _construct
/**
* Initialize form
* Add standard buttons
* Add "Save and Continue" button
*
* @return void
*/
protected function _construct()
{
$this->_objectId = 'id';
$this->_controller = 'adminhtml_promo_quote';
$this->_blockGroup = 'Magento_SalesRule';
parent::_construct();
$this->buttonList->add('save_and_continue_edit', array('class' => 'save', 'label' => __('Save and Continue Edit'), 'data_attribute' => array('mage-init' => array('button' => array('event' => 'saveAndContinueEdit', 'target' => '#edit_form')))), 10);
}
示例13: _prepareLayout
/**
* {@inheritdoc}
*
* @return $this
*/
protected function _prepareLayout()
{
$pageTitle = $this->getLayout()->createBlock('Magento\\Sales\\Block\\Adminhtml\\Order\\Create\\Header')->toHtml();
if (is_object($this->getLayout()->getBlock('page.title'))) {
$this->getLayout()->getBlock('page.title')->setPageTitle($pageTitle);
}
return parent::_prepareLayout();
}
示例14: _construct
/**
* Init container
*
* @return void
*/
protected function _construct()
{
$this->_objectId = 'sitemap_id';
$this->_controller = 'adminhtml';
$this->_blockGroup = 'Magento_Sitemap';
parent::_construct();
$this->buttonList->add('generate', array('label' => __('Save & Generate'), 'data_attribute' => array('mage-init' => array('button' => array('event' => 'save', 'target' => '#edit_form', 'eventData' => array('action' => array('args' => array('generate' => '1')))))), 'class' => 'add'));
}
示例15: getFormHtml
/**
* Return form HTML
*
* @return string
*/
public function getFormHtml()
{
$formHtml = parent::getFormHtml();
if (!$this->_storeManager->isSingleStoreMode() && $this->getWebhook()->getId()) {
$formHtml = $formHtml;
}
return $formHtml;
}