本文整理汇总了PHP中Mage_Core_Block_Text::_prepareLayout方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Block_Text::_prepareLayout方法的具体用法?PHP Mage_Core_Block_Text::_prepareLayout怎么用?PHP Mage_Core_Block_Text::_prepareLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Block_Text
的用法示例。
在下文中一共展示了Mage_Core_Block_Text::_prepareLayout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareLayout
/**
* Ensure the required JS is included
*
* @return $this
*/
protected function _prepareLayout()
{
if (($headBlock = $this->getLayout()->getBlock('head')) !== false) {
$headBlock->addJs('fishpig/wordpress/update.js');
}
return parent::_prepareLayout();
}
示例2: _prepareLayout
/**
* Add the JS
*
* @return $this
*/
protected function _prepareLayout()
{
$this->setText(sprintf("\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\t//<![CDATA[\t\t\t\t\n\t\t\t\t\t(function() {\n\t\t\t\t\t\tvar create = {\n\t\t\t\t\t\t\tgo: function() {\n\t\t\t\t\t\t\t\tthis.attr = \$('splash_attribute_id');\n\t\t\t\t\t\t\t\tthis.opt = \$('splash_option_id');\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (!this.attr || !this.opt) {\n\t\t\t\t\t\t\t\t\tthrow 'Missing required input fields';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tthis.name = \$('splash_display_name');\n\n\t\t\t\t\t\t\t\tthis.options = new Array();\n\t\t\t\t\t\t\t\tthis.onAttributeChange();\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tthis.attr.observe('change', this.onAttributeChange.bindAsEventListener(this));\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tthis.opt.observe('change', this.onOptionChange.bindAsEventListener(this));\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thasOptions: function() {\n\t\t\t\t\t\t\t\treturn typeof this.options[this.attr.getValue()] !== 'undefined';\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tupdateOptions: function() {\n\t\t\t\t\t\t\t\tthis.opt.options = null;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tthis.opt.options[0] = new Option('%s', '');\n\n\t\t\t\t\t\t\t\tthis.options[this.attr.getValue()].each(function(elem, ind) {\n\t\t\t\t\t\t\t\t\tthis.opt.options[ind+1] = new Option(elem.label, elem.value);\n\t\t\t\t\t\t\t\t}.bind(this));\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetOptions: function() {\n\t\t\t\t\t\t\t\tnew Ajax.Request('%s?attribute=' + this.attr.getValue(), {\n\t\t\t\t\t\t\t\t\tonSuccess: function(transport) {\n\t\t\t\t\t\t\t\t\t\tvar json = transport.responseText.evalJSON();\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tif (json.error) {\n\t\t\t\t\t\t\t\t\t\t\tthrow json.error;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tthis.options[this.attr.getValue()] = new Array();\n\n\t\t\t\t\t\t\t\t\t\tjson.options.each(function(elem, ind) {\n\t\t\t\t\t\t\t\t\t\t\tthis.options[this.attr.getValue()].push({'value': elem.value, 'label': elem.label});\n\t\t\t\t\t\t\t\t\t\t}.bind(this));\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tthis.updateOptions();\n\t\t\t\t\t\t\t\t\t}.bind(this)\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonAttributeChange: function() {\n\t\t\t\t\t\t\t\tif (this.hasOptions()) {\n\t\t\t\t\t\t\t\t\tthis.updateOptions();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tthis.getOptions();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonOptionChange: function() {\n\t\t\t\t\t\t\t\tif (this.opt.getValue()) {\n\t\t\t\t\t\t\t\t\tif (this.name.getValue() === '') {\n\t\t\t\t\t\t\t\t\t\tthis.name.setValue(this.opt.options[this.opt.selectedIndex].label);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t\t\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\treturn create.go();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (e) {\n\t\t\t\t\t\t\talert(e);\n\t\t\t\t\t\t}\n\t\t\t\t\t})();\n\t\t\t\t//]]>\n\t\t\t</script>\n\t\t", Mage::helper('adminhtml')->__('-- Please Select --'), Mage::getModel('adminhtml/url')->getUrl('*/*/options')));
return parent::_prepareLayout();
}