Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $this->setTemplate(myphtml.phtml);
- <?php
- namespace NamespaceModulenameBlockAdminhtmlModulenameEditTab;
- /**
- * Modulename edit form main tab
- */
- class Main extends MagentoBackendBlockWidgetFormGeneric implements MagentoBackendBlockWidgetTabTabInterface
- {
- /**
- * @var MagentoStoreModelSystemStore
- */
- protected $_systemStore;
- /**
- * @var NavGametypeModelStatus
- */
- protected $_status;
- /**
- * @param MagentoBackendBlockTemplateContext $context
- * @param MagentoFrameworkRegistry $registry
- * @param MagentoFrameworkDataFormFactory $formFactory
- * @param MagentoStoreModelSystemStore $systemStore
- * @param array $data
- */
- public function __construct(
- MagentoBackendBlockTemplateContext $context,
- MagentoFrameworkRegistry $registry,
- MagentoFrameworkDataFormFactory $formFactory,
- MagentoStoreModelSystemStore $systemStore,
- NavGametypeModelStatus $status,
- array $data = []
- ) {
- $this->_systemStore = $systemStore;
- $this->_status = $status;
- parent::__construct($context, $registry, $formFactory, $data);
- }
- /**
- * Prepare form
- *
- * @return $this
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- protected function _prepareForm()
- {
- /* @var $model NavGametypeModelBlogPosts */
- $model = $this->_coreRegistry->registry('gametype');
- $isElementDisabled = false;
- /** @var MagentoFrameworkDataForm $form */
- $form = $this->_formFactory->create();
- // $form->setHtmlIdPrefix('page_');
- $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Game Information')]);
- if ($model->getId()) {
- $fieldset->addField('nav_game_type_id', 'hidden', ['name' => 'nav_game_type_id']);
- }
- /* $fieldset->addField(
- 'title',
- 'text',
- [
- 'name' => 'title',
- 'label' => __('Title'),
- 'title' => __('Title'),
- 'required' => true,
- 'disabled' => $isElementDisabled
- ]
- );*/
- $this->setTemplate('myphtml.phtml');
- if (!$model->getId()) {
- $model->setData('is_active', $isElementDisabled ? '0' : '1');
- }
- $form->setValues($model->getData());
- $this->setForm($form);
- return parent::_prepareForm();
- }
- /**
- * Prepare label for tab
- *
- * @return MagentoFrameworkPhrase
- */
- public function getTabLabel()
- {
- return __('Game Information');
- }
- /**
- * Prepare title for tab
- *
- * @return MagentoFrameworkPhrase
- */
- public function getTabTitle()
- {
- return __('Game Information');
- }
- /**
- * {@inheritdoc}
- */
- public function canShowTab()
- {
- return true;
- }
- /**
- * {@inheritdoc}
- */
- public function isHidden()
- {
- return false;
- }
- /**
- * Check permission for passed action
- *
- * @param string $resourceId
- * @return bool
- */
- protected function _isAllowedAction($resourceId)
- {
- return $this->_authorization->isAllowed($resourceId);
- }
- public function getTargetOptionArray(){
- return array(
- '_self' => "Self",
- '_blank' => "New Page",
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement