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


PHP Observer::getBlock方法代码示例

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


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

示例1: execute

 /**
  *  blocks , handles and template info is saved for current request
  *  via helpers
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if (!$this->_devtoolData->getBlockStatus()) {
         foreach ($observer->getBlock()->getLayout()->getAllBlocks() as $block) {
             $this->_devtoolData->addBlockInfo($block->getNameInLayout(), get_class($block), $block->getTemplateFile());
         }
         $this->_devtoolData->setBlockStatus();
     }
 }
开发者ID:dineshmalekar,项目名称:Magento2-Developer-Debug-Tool,代码行数:13,代码来源:Setblockname.php

示例2: execute

 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $grid = $observer->getBlock();
     /**
      * \Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid
      */
     if ($grid instanceof \Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid) {
         $grid->addColumnAfter('expiration_date', ['header' => __('Expiration date'), 'index' => 'expiration_date', 'type' => 'datetime', 'default' => '', 'align' => 'center', 'width' => '160'], 'created_at')->addColumnAfter('generated_by_dotmailer', ['header' => __('Generated By dotmailer'), 'index' => 'generated_by_dotmailer', 'type' => 'options', 'default' => '', 'options' => ['null' => 'No', '1' => 'Yes'], 'width' => '30', 'align' => 'center', 'filter_condition_callback' => [$this, 'filterCallbackContact']], 'expiration_date');
     }
 }
开发者ID:dotmailer,项目名称:dotmailer-magento2-extension,代码行数:10,代码来源:BeforeBlockToHtml.php

示例3: execute

 /**
  * Page block html topmenu gethtml before
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if (!$this->_scopeConfig->isSetFlag(static::XML_PATH_TOP_MENU_SHOW_ITEM, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) {
         return;
     }
     /** @var \Magento\Framework\Data\Tree\Node $menu */
     $menu = $observer->getMenu();
     $block = $observer->getBlock();
     $tree = $menu->getTree();
     $data = ['name' => $this->_scopeConfig->getValue(static::XML_PATH_TOP_MENU_ITEM_TEXT, \Magento\Store\Model\ScopeInterface::SCOPE_STORE), 'id' => 'magefan-blog', 'url' => $this->_url->getBaseUrl(), 'is_active' => $block->getRequest()->getModuleName() == 'blog'];
     $node = new Node($data, 'id', $tree, $menu);
     $menu->addChild($node);
 }
开发者ID:magefan,项目名称:module-blog,代码行数:20,代码来源:PageBlockHtmlTopmenuBethtmlBeforeObserver.php

示例4: execute

 /**
  * @param mixed $observer
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  * @return void
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $observer->getBlock()->setTemplate('Magento_ProductVideo::helper/gallery.phtml');
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:9,代码来源:ChangeTemplateObserver.php

示例5: initOptionRenderer

 /**
  * Initialize product options renderer with downloadable specific params
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return $this
  */
 public function initOptionRenderer(\Magento\Framework\Event\Observer $observer)
 {
     $block = $observer->getBlock();
     $block->addOptionsRenderCfg('downloadable', 'Magento\\Downloadable\\Helper\\Catalog\\Product\\Configuration');
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:12,代码来源:Observer.php

示例6: execute

 /**
  * Initialize product options renderer with bundle specific params
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return $this
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $block = $observer->getBlock();
     $block->addOptionsRenderCfg('bundle', 'Magento\\Bundle\\Helper\\Catalog\\Product\\Configuration');
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:InitOptionRendererObserver.php


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