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


PHP Mage_Core_Block_Abstract::getNameInLayout方法代码示例

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


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

示例1: testSetGetNameInLayout

 public function testSetGetNameInLayout()
 {
     // basic setting/getting
     $this->assertEmpty($this->_block->getNameInLayout());
     $name = uniqid('name');
     $this->_block->setNameInLayout($name);
     $this->assertEquals($name, $this->_block->getNameInLayout());
     // setting second time, along with the layout
     $layout = Mage::app()->getLayout();
     $layout->createBlock('Mage_Core_Block_Template', $name);
     $block = $layout->getBlock($name);
     $this->assertInstanceOf('Mage_Core_Block_Abstract', $block);
     $block->setNameInLayout($name);
     $this->assertInstanceOf('Mage_Core_Block_Abstract', $layout->getBlock($name));
 }
开发者ID:relue,项目名称:magento2,代码行数:15,代码来源:AbstractTest.php

示例2: _generateBlock

 /**
  * Records information about new block creation
  * (non-PHPdoc)
  * @see Mage_Core_Model_Layout::_generateBlock()
  */
 protected function _generateBlock($node, $parent)
 {
     $this->_collectedBlock = null;
     parent::_generateBlock($node, $parent);
     if ($this->_collectedBlock !== null) {
         $target = $this->_collectedBlock->getNameInLayout();
         $params = array();
         if (isset($node['as'])) {
             $params['alias'] = (string) $node['as'];
         } else {
             $params['alias'] = $target;
         }
         if (isset($node['class'])) {
             $params['type'] = (string) $node['class'];
         } elseif (isset($node['type'])) {
             $params['type'] = (string) $node['type'];
         }
         $params['class'] = get_class($this->_collectedBlock);
         $params['is_root'] = isset($node['output']);
         $this->record(self::ACTION_BLOCK_CREATED, $target, $params);
         if (isset($node['template'])) {
             $this->record(self::ACTION_BLOCK_ACTION, $target . '::setTemplate', array('template' => (string) $node['template']));
         }
     }
     return $this;
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:31,代码来源:Layout.php

示例3: getBlockPlaceholder

 /**
  * Create placeholder object based on block information
  *
  * @param Mage_Core_Block_Abstract $block
  * @return Enterprise_PageCache_Model_Container_Placeholder
  */
 public function getBlockPlaceholder($block)
 {
     $this->_initPlaceholders();
     $type = $block->getType();
     if (isset($this->_placeholders[$type])) {
         $placeholderData = false;
         foreach ($this->_placeholders[$type] as $placeholderInfo) {
             if (!empty($placeholderInfo['name'])) {
                 if ($placeholderInfo['name'] == $block->getNameInLayout()) {
                     $placeholderData = $placeholderInfo;
                 }
             } else {
                 $placeholderData = $placeholderInfo;
             }
         }
         if (!$placeholderData) {
             return false;
         }
         $placeholder = $placeholderData['code'] . ' container="' . $placeholderData['container'] . '"' . ' block="' . get_class($block) . '"';
         $placeholder .= ' cache_id="' . $block->getCacheKey() . '"';
         foreach ($block->getCacheKeyInfo() as $k => $v) {
             if (is_string($k) && !empty($k)) {
                 $placeholder .= ' ' . $k . '="' . $v . '"';
             }
         }
         $placeholder = Mage::getModel('enterprise_pagecache/container_placeholder', $placeholder);
         return $placeholder;
     }
     return false;
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:36,代码来源:Config.php

示例4: delayPrepareLayout

 /**
  * @param Mage_Core_Block_Abstract $block
  */
 public function delayPrepareLayout($block, $sortOrder = 0)
 {
     if ($this->_delayedLayoutIsBeingProcessed || Mage::registry('m_page_is_being_rendered')) {
         $block->delayedPrepareLayout();
     } else {
         $this->_delayPrepareLayoutBlocks[$block->getNameInLayout()] = compact('block', 'sortOrder');
     }
 }
开发者ID:xiaoguizhidao,项目名称:cupboardglasspipes.ecomitize.com,代码行数:11,代码来源:Layout.php

示例5: 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

示例6: getBlockAlias

 /**
  * @param Mage_Core_Block_Abstract $block
  */
 public function getBlockAlias($block)
 {
     if (($parent = $block->getParentBlock()) && $this->startsWith($block->getNameInLayout(), $parent->getNameInLayout() . '.')) {
         return substr($block->getNameInLayout(), strlen($parent->getNameInLayout() . '.'));
     } else {
         return $block->getNameInLayout();
     }
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:11,代码来源:Data.php

示例7: getLayoutHash

 /**
  * Return a hash of the block layout XML in the current configuration,
  * this is used to identify a unique rendering of the block as we cache
  * all ESI requests
  *
  * @param Mage_Core_Block_Abstract $block
  */
 public function getLayoutHash(Mage_Core_Block_Abstract $block)
 {
     $xml = $block->getLayout()->getNode();
     $doc = new DOMDocument();
     $doc->loadXML($xml->asXML());
     $xpath = new DOMXpath($doc);
     $nodeList = $xpath->query("//block[@name='" . $block->getNameInLayout() . "']");
     return sha1($doc->saveXML($nodeList->item(0)));
 }
开发者ID:eneiasramos,项目名称:Made_Cache,代码行数:16,代码来源:Varnish.php

示例8: addBlock

 /**
  * Add a block to registry, create new object if needed
  *
  * @param string|Mage_Core_Block_Abstract $block
  * @param string $name
  * @param string $parent
  * @param string $alias
  * @return Mage_Core_Block_Abstract
  */
 public function addBlock($block, $name = '', $parent = '', $alias = '')
 {
     if (empty($name) && $block instanceof Mage_Core_Block_Abstract) {
         $name = $block->getNameInLayout();
     }
     $name = $this->_createStructuralElement($name, self::TYPE_BLOCK, $name ?: (is_object($block) ? get_class($block) : $block));
     if ($parent) {
         $this->_structure->setAsChild($name, $parent, $alias);
     }
     return $this->_createBlock($block, $name);
 }
开发者ID:natxetee,项目名称:magento2,代码行数:20,代码来源:Layout.php

示例9: insert

 /**
  * Insert child element into specified position
  *
  * By default inserts as first element into children list
  *
  * @param Mage_Core_Block_Abstract|string $element
  * @param string|int|null $siblingName
  * @param bool $after
  * @param string $alias
  * @return Mage_Core_Block_Abstract|bool
  */
 public function insert($element, $siblingName = 0, $after = true, $alias = '')
 {
     $layout = $this->getLayout();
     if (!$layout) {
         return false;
     }
     if ($element instanceof Mage_Core_Block_Abstract) {
         $elementName = $element->getNameInLayout();
     } else {
         $elementName = $element;
     }
     $layout->setChild($this->_nameInLayout, $elementName, $alias);
     $layout->reorderChild($this->_nameInLayout, $elementName, $siblingName, $after);
     return $this;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:26,代码来源:Abstract.php


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