protected function _construct() { $this->_objectId = 'api_key'; $this->_blockGroup = 'Expressly_Expressly'; $this->_controller = 'expressly_dashboard'; parent::_construct(); }
/** * Prepare block */ public function _construct() { parent::_construct(); $this->_blockGroup = 'Remarkety_Mgconnector'; $this->_controller = 'adminhtml_queue'; $this->_headerText = $this->__('Queue Configuration'); }
/** * 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'); } }
/** * _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();'; } }
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"; }
/** * 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() . '\')']); } }
/** * 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); } }
/** * {@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); }
/** * Constructor * * @return void * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ protected function _construct() { $this->_objectId = 'invoice_id'; $this->_controller = 'adminhtml_order_invoice'; $this->_mode = 'view'; $this->_session = $this->_backendSession; parent::_construct(); $this->buttonList->remove('save'); $this->buttonList->remove('reset'); $this->buttonList->remove('delete'); if (!$this->getInvoice()) { return; } if ($this->_isAllowedAction('Magento_Sales::cancel') && $this->getInvoice()->canCancel() && !$this->_isPaymentReview()) { $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 an invoice email to customer?') . '\', \'' . $this->getEmailUrl() . '\')']); } $orderPayment = $this->getInvoice()->getOrder()->getPayment(); if ($this->_isAllowedAction('Magento_Sales::creditmemo') && $this->getInvoice()->getOrder()->canCreditmemo()) { if ($orderPayment->canRefundPartialPerInvoice() && $this->getInvoice()->canRefund() && $orderPayment->getAmountPaid() > $orderPayment->getAmountRefunded() || $orderPayment->canRefund() && !$this->getInvoice()->getIsUsedForRefund()) { $this->buttonList->add('capture', ['label' => __('Credit Memo'), 'class' => 'credit-memo', 'onclick' => 'setLocation(\'' . $this->getCreditMemoUrl() . '\')']); } } if ($this->_isAllowedAction('Magento_Sales::capture') && $this->getInvoice()->canCapture() && !$this->_isPaymentReview()) { $this->buttonList->add('capture', ['label' => __('Capture'), 'class' => 'capture', 'onclick' => 'setLocation(\'' . $this->getCaptureUrl() . '\')']); } if ($this->getInvoice()->canVoid()) { $this->buttonList->add('void', ['label' => __('Void'), 'class' => 'void', 'onclick' => 'setLocation(\'' . $this->getVoidUrl() . '\')']); } if ($this->getInvoice()->getId()) { $this->buttonList->add('print', ['label' => __('Print'), 'class' => 'print', 'onclick' => 'setLocation(\'' . $this->getPrintUrl() . '\')']); } }
/** * 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(); }
public function _prepareLayout() { $this->_blockGroup = 'Remarkety_Mgconnector'; $this->_controller = 'adminhtml_queue'; $this->_headerText = __('Remarkety Configuration'); $this->_nameInLayout = 'mgconnectorconfig'; return parent::_prepareLayout(); }
/** * 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'; }
/** * 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); }
/** * {@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(); }
/** * 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')); }
/** * Return form HTML * * @return string */ public function getFormHtml() { $formHtml = parent::getFormHtml(); if (!$this->_storeManager->isSingleStoreMode() && $this->getWebhook()->getId()) { $formHtml = $formHtml; } return $formHtml; }
/** * Internal constructor * * @SuppressWarnings(PHPMD.CamelCaseMethodName) * * @return void */ protected function _construct() { $this->_objectId = 'id'; $this->_blockGroup = 'Smile_ElasticsuiteThesaurus'; $this->_controller = 'adminhtml_thesaurus'; parent::_construct(); $this->buttonList->update('save', 'label', __('Create Thesaurus')); }
/** * Initialize form * Add standard buttons * Add "Save and Continue" button * * @return void */ protected function _construct() { $this->_objectId = 'id'; $this->_controller = 'adminhtml_banners'; $this->_blockGroup = 'TanDinh_Banner'; parent::_construct(); $this->buttonList->add('save_and_continue_edit', ['class' => 'save', 'label' => __('Save and Continue Edit'), 'data_attribute' => ['mage-init' => ['button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form']]]], 10); }
/** * {@inheritdoc} */ protected function _construct() { $this->_blockGroup = 'Mirasvit_Search'; $this->_controller = 'adminhtml_stopword'; $this->_mode = 'import'; parent::_construct(); $this->buttonList->update('save', 'label', __('Import')); }
/** * @return void */ protected function _construct() { $this->_objectId = 'order_id'; $this->_mode = 'create'; parent::_construct(); $this->buttonList->remove('save'); $this->buttonList->remove('delete'); }
/** * @return void */ protected function _construct() { $this->_objectId = 'id'; $this->_blockGroup = 'Magento_Search'; $this->_controller = 'adminhtml_term'; parent::_construct(); $this->buttonList->update('save', 'label', __('Save Search')); $this->buttonList->update('delete', 'label', __('Delete Search')); }
/** * Init class * * @return void */ protected function _construct() { $this->_objectId = 'id'; $this->_controller = 'adminhtml_agreement'; $this->_blockGroup = 'Magento_CheckoutAgreements'; parent::_construct(); $this->buttonList->update('save', 'label', __('Save Condition')); $this->buttonList->update('delete', 'label', __('Delete Condition')); }
/** * Initialize form * Add standard buttons * Add "Save and Apply" button * Add "Save and Continue" button * * @return void */ protected function _construct() { $this->_objectId = 'id'; $this->_blockGroup = 'Magento_CatalogRule'; $this->_controller = 'adminhtml_promo_catalog'; parent::_construct(); $this->buttonList->add('save_apply', ['class' => 'save', 'label' => __('Save and Apply'), 'data_attribute' => ['mage-init' => ['button' => ['event' => 'save', 'target' => '#edit_form', 'eventData' => ['action' => ['args' => ['auto_apply' => 1]]]]]]]); $this->buttonList->add('save_and_continue_edit', ['class' => 'save', 'label' => __('Save and Continue Edit'), 'data_attribute' => ['mage-init' => ['button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form']]]], 10); }
/** * Class constructor * * @return void */ protected function _construct() { $this->_objectId = 'user_id'; $this->_controller = 'user'; $this->_blockGroup = 'Magento_User'; parent::_construct(); $this->buttonList->update('save', 'label', __('Save User')); $this->buttonList->update('delete', 'label', __('Delete User')); }
/** * Prepare layout. * Adding save_and_continue button * * @return $this */ protected function _preparelayout() { if ($this->getWidgetInstance()->isCompleteToCreate()) { $this->buttonList->add('save_and_edit_button', array('label' => __('Save and Continue Edit'), 'class' => 'save', 'data_attribute' => array('mage-init' => array('button' => array('event' => 'saveAndContinueEdit', 'target' => '#edit_form')))), 100); } else { $this->removeButton('save'); } return parent::_prepareLayout(); }
/** * Constructor * * @return void */ protected function _construct() { $this->_controller = 'adminhtml_order'; $this->_mode = 'address'; $this->_blockGroup = 'Magento_Sales'; parent::_construct(); $this->buttonList->update('save', 'label', __('Save Order Address')); $this->buttonList->remove('delete'); }
/** * Constructor * * @return void */ protected function _construct() { $this->_objectId = 'order_id'; $this->_controller = 'adminhtml_order_creditmemo'; $this->_mode = 'create'; parent::_construct(); $this->buttonList->remove('delete'); $this->buttonList->remove('save'); }
/** * {@inheritdoc} */ protected function _construct() { parent::_construct(); $this->_objectId = 'entity_id'; $this->_controller = 'adminhtml_post'; $this->_blockGroup = 'Mirasvit_Blog'; $this->buttonList->remove('save'); $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-update', 'options' => [['id' => 'save-button', 'label' => __('Save'), 'default' => true, 'data_attribute' => ['mage-init' => ['button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form']]]], ['id' => 'save-continue-button', 'label' => __('Save & Close'), 'data_attribute' => ['mage-init' => ['button' => ['event' => 'save', 'target' => '#edit_form']]]]]]); }
/** * Constructor * * @return void */ protected function _construct() { $this->_objectId = 'id'; $this->_controller = 'adminhtml_tax_classes_' . \strtolower($this->classType); $this->_blockGroup = 'ClassyLlama_AvaTax'; $this->_mode = 'newClass'; parent::_construct(); $this->buttonList->update('save', 'label', __('Save Tax Class')); }
/** * @return void */ protected function _construct() { parent::_construct(); $this->_blockGroup = 'Magento_Backend'; $this->_controller = 'system_account'; $this->buttonList->update('save', 'label', __('Save Account')); $this->buttonList->remove('delete'); $this->buttonList->remove('back'); }