本文整理汇总了PHP中Mage_Core_Block_Template::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Block_Template::setData方法的具体用法?PHP Mage_Core_Block_Template::setData怎么用?PHP Mage_Core_Block_Template::setData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Block_Template
的用法示例。
在下文中一共展示了Mage_Core_Block_Template::setData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wrapPageElement
/**
* Wrap each element of a page that is being rendered, with a block-level HTML-element to highlight it in VDE
*
* Subscriber to event 'core_layout_render_element'
*
* @param Varien_Event_Observer $observer
*/
public function wrapPageElement(Varien_Event_Observer $observer)
{
if (!$this->_getSession()->isDesignEditorActive()) {
return;
}
if (!$this->_wrappingRenderer) {
$this->_wrappingRenderer = Mage::getModel('Mage_DesignEditor_Block_Template', array('template' => 'wrapping.phtml'));
}
$event = $observer->getEvent();
/** @var $layout Mage_Core_Model_Layout */
$layout = $event->getData('layout');
$elementName = $event->getData('element_name');
/** @var $transport Varien_Object */
$transport = $event->getData('transport');
$block = $layout->getBlock($elementName);
$isVde = $block && 0 === strpos(get_class($block), 'Mage_DesignEditor_Block_');
$manipulationAllowed = $layout->isManipulationAllowed($elementName) && !$isVde;
$isContainer = $layout->isContainer($elementName);
if ($manipulationAllowed || $isContainer) {
$elementId = 'vde_element_' . rtrim(strtr(base64_encode($elementName), '+/', '-_'), '=');
$this->_wrappingRenderer->setData(array('element_id' => $elementId, 'element_title' => $layout->getElementProperty($elementName, 'label') ?: $elementName, 'element_html' => $transport->getData('output'), 'is_manipulation_allowed' => $manipulationAllowed, 'is_container' => $isContainer, 'element_name' => $elementName));
$transport->setData('output', $this->_wrappingRenderer->toHtml());
}
/* Inject toolbar at the very beginning of the page */
if ($elementName == 'after_body_start') {
$elementHtml = $transport->getData('output');
$toolbarHtml = $layout->renderElement('design_editor_toolbar');
$transport->setData('output', $toolbarHtml . $elementHtml);
}
}