当前位置: 首页>>代码示例>>PHP>>正文


PHP Tabs::_prepareLayout方法代码示例

本文整理汇总了PHP中Magento\Backend\Block\Widget\Tabs::_prepareLayout方法的典型用法代码示例。如果您正苦于以下问题:PHP Tabs::_prepareLayout方法的具体用法?PHP Tabs::_prepareLayout怎么用?PHP Tabs::_prepareLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Backend\Block\Widget\Tabs的用法示例。


在下文中一共展示了Tabs::_prepareLayout方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _prepareLayout

 /**
  * Prepare Layout Content
  *
  * @return $this
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 protected function _prepareLayout()
 {
     $this->addTab('category', ['label' => __('Category information'), 'content' => $this->getLayout()->createBlock('Mageplaza\\Blog\\Block\\Adminhtml\\Category\\Edit\\Tab\\Category', 'mageplaza_blog_category_edit_tab_category')->toHtml()]);
     $this->addTab('post', ['label' => __('Posts'), 'content' => $this->getLayout()->createBlock('Mageplaza\\Blog\\Block\\Adminhtml\\Category\\Edit\\Tab\\Post', 'mageplaza_blog_category_edit_tab_post')->toHtml()]);
     // dispatch event add custom tabs
     $this->_eventManager->dispatch('adminhtml_mageplaza_blog_category_tabs', ['tabs' => $this]);
     return parent::_prepareLayout();
 }
开发者ID:mageplaza,项目名称:magento-2-blog-extension,代码行数:14,代码来源:Tabs.php

示例2: _prepareLayout

 /**
  * @return $this
  */
 protected function _prepareLayout()
 {
     $role = $this->_coreRegistry->registry('current_role');
     $this->addTab('info', $this->getLayout()->createBlock('Magento\\User\\Block\\Role\\Tab\\Info')->setRole($role)->setActive(true));
     if ($role->getId()) {
         $this->addTab('roles', array('label' => __('Role Users'), 'title' => __('Role Users'), 'content' => $this->getLayout()->createBlock('Magento\\User\\Block\\Role\\Tab\\Users', 'role.users.grid')->toHtml()));
     }
     return parent::_prepareLayout();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:12,代码来源:Edit.php

示例3: _prepareLayout

 /**
  * Prepare layout for dashboard bottom tabs
  *
  * To load block statically:
  *     1) content must be generated
  *     2) url should not be specified
  *     3) class should not be 'ajax'
  * To load with ajax:
  *     1) do not load content
  *     2) specify url (BE CAREFUL)
  *     3) specify class 'ajax'
  *
  * @return $this
  */
 protected function _prepareLayout()
 {
     // load this active tab statically
     $this->addTab('ordered_products', array('label' => __('Bestsellers'), 'content' => $this->getLayout()->createBlock('Magento\\Backend\\Block\\Dashboard\\Tab\\Products\\Ordered')->toHtml(), 'active' => true));
     // load other tabs with ajax
     $this->addTab('reviewed_products', array('label' => __('Most Viewed Products'), 'url' => $this->getUrl('adminhtml/*/productsViewed', array('_current' => true)), 'class' => 'ajax'));
     $this->addTab('new_customers', array('label' => __('New Customers'), 'url' => $this->getUrl('adminhtml/*/customersNewest', array('_current' => true)), 'class' => 'ajax'));
     $this->addTab('customers', array('label' => __('Customers'), 'url' => $this->getUrl('adminhtml/*/customersMost', array('_current' => true)), 'class' => 'ajax'));
     return parent::_prepareLayout();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:24,代码来源:Grids.php

示例4: _prepareLayout

 /**
  * {@inheritdoc}
  */
 protected function _prepareLayout()
 {
     $this->addTab('general', ['label' => __('General'), 'content' => $this->getLayout()->createBlock('Magento\\Backend\\Block\\System\\Design\\Edit\\Tab\\General')->toHtml()]);
     return parent::_prepareLayout();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:8,代码来源:Tabs.php

示例5: _prepareLayout

 /**
  * @return $this
  */
 protected function _prepareLayout()
 {
     $this->addTab('orders', ['label' => __('Orders'), 'content' => $this->getLayout()->createBlock('Magento\\Backend\\Block\\Dashboard\\Tab\\Orders')->toHtml(), 'active' => true]);
     $this->addTab('amounts', ['label' => __('Amounts'), 'content' => $this->getLayout()->createBlock('Magento\\Backend\\Block\\Dashboard\\Tab\\Amounts')->toHtml()]);
     return parent::_prepareLayout();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:9,代码来源:Diagrams.php

示例6: _prepareLayout

 /**
  * @return $this
  */
 protected function _prepareLayout()
 {
     $this->setChild('userGrid', $this->getLayout()->createBlock('Magento\\User\\Block\\Role\\Grid\\User', 'roleUsersGrid'));
     return parent::_prepareLayout();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:8,代码来源:Users.php

示例7: _prepareLayout

 /**
  * @return $this
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function _prepareLayout()
 {
     $product = $this->getProduct();
     if (!($setId = $product->getAttributeSetId())) {
         $setId = $this->getRequest()->getParam('set', null);
     }
     if ($setId) {
         $tabAttributesBlock = $this->getLayout()->createBlock($this->getAttributeTabBlock(), $this->getNameInLayout() . '_attributes_tab');
         $advancedGroups = [];
         foreach ($this->getGroupCollection($setId) as $group) {
             /** @var $group \Magento\Eav\Model\Entity\Attribute\Group*/
             $attributes = $product->getAttributes($group->getId(), true);
             foreach ($attributes as $key => $attribute) {
                 $applyTo = $attribute->getApplyTo();
                 if (!$attribute->getIsVisible() || !empty($applyTo) && !in_array($product->getTypeId(), $applyTo)) {
                     unset($attributes[$key]);
                 }
             }
             if ($attributes) {
                 $tabData = ['label' => __($group->getAttributeGroupName()), 'content' => $this->_translateHtml($tabAttributesBlock->setGroup($group)->setGroupAttributes($attributes)->toHtml()), 'class' => 'user-defined', 'group_code' => $group->getTabGroupCode() ?: self::BASIC_TAB_GROUP_CODE];
                 if ($tabData['group_code'] === self::BASIC_TAB_GROUP_CODE) {
                     $this->addTab($group->getAttributeGroupCode(), $tabData);
                 } else {
                     $advancedGroups[$group->getAttributeGroupCode()] = $tabData;
                 }
             }
         }
         /* Don't display website tab for single mode */
         if (!$this->_storeManager->isSingleStoreMode()) {
             $this->addTab('websites', ['label' => __('Websites'), 'content' => $this->_translateHtml($this->getLayout()->createBlock('Magento\\Catalog\\Block\\Adminhtml\\Product\\Edit\\Tab\\Websites')->toHtml()), 'group_code' => self::BASIC_TAB_GROUP_CODE]);
         }
         if (isset($advancedGroups['advanced-pricing'])) {
             $this->addTab('advanced-pricing', $advancedGroups['advanced-pricing']);
             unset($advancedGroups['advanced-pricing']);
         }
         if ($this->_moduleManager->isEnabled('Magento_CatalogInventory')) {
             $this->addTab('advanced-inventory', ['label' => __('Advanced Inventory'), 'content' => $this->_translateHtml($this->getLayout()->createBlock('Magento\\Catalog\\Block\\Adminhtml\\Product\\Edit\\Tab\\Inventory')->toHtml()), 'group_code' => self::ADVANCED_TAB_GROUP_CODE]);
         }
         /**
          * Do not change this tab id
          */
         if ($this->getChildBlock('customer_options')) {
             $this->addTab('customer_options', 'customer_options');
             $this->getChildBlock('customer_options')->setGroupCode(self::ADVANCED_TAB_GROUP_CODE);
         }
         $this->addTab('related', ['label' => __('Related Products'), 'url' => $this->getUrl('catalog/*/related', ['_current' => true]), 'class' => 'ajax', 'group_code' => self::ADVANCED_TAB_GROUP_CODE]);
         $this->addTab('upsell', ['label' => __('Up-sells'), 'url' => $this->getUrl('catalog/*/upsell', ['_current' => true]), 'class' => 'ajax', 'group_code' => self::ADVANCED_TAB_GROUP_CODE]);
         $this->addTab('crosssell', ['label' => __('Cross-sells'), 'url' => $this->getUrl('catalog/*/crosssell', ['_current' => true]), 'class' => 'ajax', 'group_code' => self::ADVANCED_TAB_GROUP_CODE]);
         if (isset($advancedGroups['design'])) {
             $this->addTab('design', $advancedGroups['design']);
             unset($advancedGroups['design']);
         }
         if ($this->getChildBlock('product-alerts')) {
             $this->addTab('product-alerts', 'product-alerts');
             $this->getChildBlock('product-alerts')->setGroupCode(self::ADVANCED_TAB_GROUP_CODE);
         }
         if (isset($advancedGroups['autosettings'])) {
             $this->addTab('autosettings', $advancedGroups['autosettings']);
             unset($advancedGroups['autosettings']);
         }
         foreach ($advancedGroups as $groupCode => $group) {
             $this->addTab($groupCode, $group);
         }
     }
     return parent::_prepareLayout();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:72,代码来源:Tabs.php

示例8: _prepareLayout

 /**
  * Prepare Layout Content
  *
  * @return $this
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 protected function _prepareLayout()
 {
     $categoryAttributes = $this->getCategory()->getAttributes();
     if (!$this->getCategory()->getId()) {
         foreach ($categoryAttributes as $attribute) {
             $default = $attribute->getDefaultValue();
             if ($default != '') {
                 $this->getCategory()->setData($attribute->getAttributeCode(), $default);
             }
         }
     }
     $attributeSetId = $this->getCategory()->getDefaultAttributeSetId();
     /** @var $groupCollection \Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\Collection */
     $groupCollection = $this->_collectionFactory->create()->setAttributeSetFilter($attributeSetId)->setSortOrder()->load();
     $defaultGroupId = 0;
     foreach ($groupCollection as $group) {
         /* @var $group \Magento\Eav\Model\Entity\Attribute\Group */
         if ($defaultGroupId == 0 or $group->getIsDefault()) {
             $defaultGroupId = $group->getId();
         }
     }
     foreach ($groupCollection as $group) {
         /* @var $group \Magento\Eav\Model\Entity\Attribute\Group */
         $attributes = [];
         foreach ($categoryAttributes as $attribute) {
             /* @var $attribute \Magento\Eav\Model\Entity\Attribute */
             if ($attribute->isInGroup($attributeSetId, $group->getId())) {
                 $attributes[] = $attribute;
             }
         }
         // do not add grops without attributes
         if (!$attributes) {
             continue;
         }
         $active = $defaultGroupId == $group->getId();
         $block = $this->getLayout()->createBlock($this->getAttributeTabBlock(), $this->getNameInLayout() . '_tab_' . $group->getAttributeGroupName())->setGroup($group)->setAttributes($attributes)->setAddHiddenFields($active)->toHtml();
         $this->addTab('group_' . $group->getId(), ['label' => __($group->getAttributeGroupName()), 'content' => $block, 'active' => $active]);
     }
     $this->addTab('products', ['label' => __('Category Products'), 'content' => $this->getLayout()->createBlock('Magento\\Catalog\\Block\\Adminhtml\\Category\\Tab\\Product', 'category.product.grid')->toHtml()]);
     // dispatch event add custom tabs
     $this->_eventManager->dispatch('adminhtml_catalog_category_tabs', ['tabs' => $this]);
     /*$this->addTab('features', array(
       'label'     => __('Feature Products'),
       'content'   => 'Feature Products'
       ));        */
     return parent::_prepareLayout();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:53,代码来源:Tabs.php

示例9: _prepareLayout

 protected function _prepareLayout()
 {
     //  $lists = $this->_coreRegistry->registry('lists');
     $this->addTabAfter('gridtabs', ['label' => __('Grid Tabs'), 'title' => __('Grid Tabs'), 'content' => $this->getLayout()->createBlock('Sugarcode\\Test\\Block\\Adminhtml\\Lists\\Edit\\Tab\\Gridtabs', 'test.lists.grid.tabs')->setActive(true)->toHtml()], 'main_section');
     return parent::_prepareLayout();
 }
开发者ID:pradeeprcs,项目名称:TestModule,代码行数:6,代码来源:Tabs.php


注:本文中的Magento\Backend\Block\Widget\Tabs::_prepareLayout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。