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


PHP Mage_Core_Block_Abstract::getBlockAlias方法代码示例

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


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

示例1: testGetBlockAlias

 public function testGetBlockAlias()
 {
     // Without layout
     $this->assertEmpty($this->_block->getBlockAlias());
     $this->assertInternalType('string', $this->_block->getBlockAlias());
     // Without alias
     $block1 = $this->_createBlockWithLayout('name1');
     $this->assertEquals('name1', $block1->getBlockAlias());
     // With alias
     $block2 = $this->_createBlockWithLayout('name2', 'alias');
     $this->assertEquals('alias', $block2->getBlockAlias());
     // Change block's alias while changing parent
     $blockParent = $this->_createBlockWithLayout('parent', 'parent');
     $blockChild = $this->_createBlockWithLayout('child', 'child');
     $this->assertEquals('child', $blockChild->getBlockAlias());
     $blockParent->setChild('parent_child', $blockChild);
     $this->assertEquals('parent_child', $blockChild->getBlockAlias());
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:18,代码来源:Abstract.php

示例2: getBlockInfo

 /**
  * Get block information
  *
  * @param Mage_Core_Block_Abstract $block
  * @param bool $fullInfo
  * @return array
  */
 public function getBlockInfo(Mage_Core_Block_Abstract $block, $fullInfo = true)
 {
     $info = array('name' => $block->getNameInLayout(), 'alias' => $block->getBlockAlias());
     if (!$fullInfo) {
         return $info;
     }
     $info['class'] = get_class($block);
     if ($this->getRemoteCallEnabled()) {
         $fileAndLine = Mage::helper('aoe_templatehints/classInfo')->findFileAndLine($info['class']);
         if ($fileAndLine) {
             $url = sprintf($this->getRemoteCallUrlTemplate(), $fileAndLine['file'], $fileAndLine['line']);
             $info['class'] = sprintf($this->getRemoteCallLinkTemplate(), $url, $info['class']);
         }
     }
     $info['module'] = $block->getModuleName();
     if ($block instanceof Mage_Cms_Block_Block) {
         $info['cms-blockId'] = $block->getBlockId();
     }
     if ($block instanceof Mage_Cms_Block_Page) {
         $info['cms-pageId'] = $block->getPage()->getIdentifier();
     }
     $templateFile = $block->getTemplateFile();
     if ($templateFile) {
         $info['template'] = $templateFile;
         if ($this->getRemoteCallEnabled()) {
             $url = sprintf($this->getRemoteCallUrlTemplate(), Mage::getBaseDir('design') . DS . $templateFile, 0);
             $info['template'] = sprintf($this->getRemoteCallLinkTemplate(), $url, $templateFile);
         }
     }
     // cache information
     $info['cache-status'] = self::TYPE_NOTCACHED;
     $cacheLifeTime = $block->getCacheLifetime();
     if (!is_null($cacheLifeTime)) {
         $info['cache-lifetime'] = intval($cacheLifeTime) == 0 ? 'forever' : intval($cacheLifeTime) . ' sec';
         $info['cache-key'] = $block->getCacheKey();
         $info['cache-key-info'] = is_array($block->getCacheKeyInfo()) ? implode(', ', $block->getCacheKeyInfo()) : $block->getCacheKeyInfo();
         $info['tags'] = implode(',', $block->getCacheTags());
         $info['cache-status'] = self::TYPE_CACHED;
     } elseif ($this->isWithinCachedBlock($block)) {
         $info['cache-status'] = self::TYPE_IMPLICITLYCACHED;
         // not cached, but within cached
     }
     $info['methods'] = $this->getClassMethods(get_class($block));
     return $info;
 }
开发者ID:MikeTayC,项目名称:Aoe_TemplateHints,代码行数:52,代码来源:BlockInfo.php

示例3: addToChildGroup

 /**
  * Make sure specified block will be registered in the specified child groups
  *
  * @param string $groupName
  * @param Mage_Core_Block_Abstract $child
  */
 public function addToChildGroup($groupName, Mage_Core_Block_Abstract $child)
 {
     if (!isset($this->_childGroups[$groupName])) {
         $this->_childGroups[$groupName] = array();
     }
     if (!in_array($child->getBlockAlias(), $this->_childGroups[$groupName])) {
         $this->_childGroups[$groupName][] = $child->getBlockAlias();
     }
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:15,代码来源:Abstract.php

示例4: testGetSetBlockAlias

 public function testGetSetBlockAlias()
 {
     $this->assertEmpty($this->_block->getBlockAlias());
     $this->_block->setBlockAlias('alias');
     $this->assertEquals('alias', $this->_block->getBlockAlias());
 }
开发者ID:relue,项目名称:magento2,代码行数:6,代码来源:AbstractTest.php


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