本文整理汇总了PHP中Varien_Event_Observer::getLayout方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Event_Observer::getLayout方法的具体用法?PHP Varien_Event_Observer::getLayout怎么用?PHP Varien_Event_Observer::getLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Event_Observer
的用法示例。
在下文中一共展示了Varien_Event_Observer::getLayout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeGenerateBlocks
public function beforeGenerateBlocks(Varien_Event_Observer $observer)
{
if (Mage::getSingleton('core/design_package')->getPackageName() == 'default' && Mage::getDesign()->getTheme('frontend') == 'galayomarket') {
# Disable default magento navigation
if (Mage::helper('yomarketsettings')->getGeneral_DisableDefaultNav() && Mage::getConfig()->getModuleConfig('EM_Megamenupro')->is('active', 'true')) {
$blocks = $observer->getLayout()->getXpath('//block[@name="galayomarket.catalog.topnav"]');
if (!empty($blocks)) {
$blocks[0]->addAttribute('ignore', true);
}
}
if (Mage::helper('yomarketsettings')->getGeneral_DisableDefaultNav() && Mage::getConfig()->getModuleConfig('EM_Megamenupro')->is('active', 'true')) {
$blocks = $observer->getLayout()->getXpath('//block[@name="galayomarket.catalog.topnav.left"]');
if (!empty($blocks)) {
$blocks[0]->addAttribute('ignore', true);
}
}
# Disable Gala variation module on frontend
if (Mage::helper('yomarketsettings')->getGeneral_DisableFrontendVariation()) {
$blocks = $observer->getLayout()->getXpath('//block[@name="em_variation_tpl" or @name="mobile_view"]');
foreach ($blocks as $block) {
$block->addAttribute('ignore', true);
}
}
# Disable default Magento footer links
if (Mage::helper('yomarketsettings')->getGeneral_DisableFooterLinks()) {
$blocks = $observer->getLayout()->getXpath('//block[@name="footer_links"]');
if (!empty($blocks)) {
$blocks[0]->addAttribute('ignore', true);
}
}
}
}
示例2: useAlgoliaSearchPopup
/**
* Call algoliasearch.xml To load js / css / phtml
*/
public function useAlgoliaSearchPopup(Varien_Event_Observer $observer)
{
if ($this->config->isEnabledFrontEnd()) {
if ($this->config->getApplicationID() && $this->config->getAPIKey()) {
if ($this->config->isPopupEnabled() || $this->config->isInstantEnabled()) {
$observer->getLayout()->getUpdate()->addHandle('algolia_search_handle');
if ($this->config->isDefaultSelector()) {
$observer->getLayout()->getUpdate()->addHandle('algolia_search_handle_with_topsearch');
} else {
$observer->getLayout()->getUpdate()->addHandle('algolia_search_handle_no_topsearch');
}
}
}
}
return $this;
}
示例3: useAlgoliaSearchPopup
/**
* Call algoliasearch.xml To load js / css / phtml
*/
public function useAlgoliaSearchPopup(Varien_Event_Observer $observer)
{
if ($this->config->isPopupEnabled() || $this->config->isInstantEnabled()) {
$observer->getLayout()->getUpdate()->addHandle('algolia_search_handle');
}
return $this;
}
示例4: useAlgoliaSearchPopup
/**
* Check whether algolia search popup is allowed
*
* @param Varien_Event_Observer $observer
* @return Algolia_Algoliasearch_Model_Observer
*/
public function useAlgoliaSearchPopup(Varien_Event_Observer $observer)
{
if (Mage::helper('algoliasearch')->isPopupEnabled()) {
$observer->getLayout()->getUpdate()->addHandle('algolia_search_handle');
}
return $this;
}
示例5: setTag
public function setTag(Varien_Event_Observer $evt)
{
$handles = $evt->getLayout()->getUpdate()->getHandles();
$tags = array_intersect($handles, self::$tags);
$tag = array_pop($tags);
$evt->getEvent()->getLayout()->getUpdate()->addHandle('konduto_js');
$evt->getEvent()->getLayout()->getUpdate()->addHandle('konduto_' . $tag);
}
示例6: controller_action_layout_load_before
/**
* Performs order_creage_loadBlock response update
* adds totals block to each response
* This function is depricated, the totals block update is implemented
* in phoenix/cashondelivery/sales.js (SalesOrder class extension)
*
* @param Varien_Event_Observer $observer
*/
public function controller_action_layout_load_before(Varien_Event_Observer $observer)
{
$action = $observer->getAction();
if ($action->getFullActionName() != 'adminhtml_sales_order_create_loadBlock' || !$action->getRequest()->getParam('json')) {
return;
}
$layout = $observer->getLayout();
$layout->getUpdate()->addHandle('adminhtml_sales_order_create_load_block_totals');
}
示例7: modifyLayout
/**
* Add / remove layout handles etc. before the layout loads.
*
* @param Varien_Event_Observer $observer
*/
public function modifyLayout(Varien_Event_Observer $observer)
{
if ($this->_getControllerName() == 'system_config') {
$section = Mage::app()->getRequest()->getParam('section');
if ($section == 'ddq') {
$observer->getLayout()->getUpdate()->addHandle('adminhtml_system_config_edit_section_ddq');
}
}
}
示例8: onLayoutInitialize
public function onLayoutInitialize(Varien_Event_Observer $observer)
{
/** @var EcomDev_LayoutCompiler_Contract_FactoryInterface $factory */
$factory = $observer->getFactory();
$itemActionClass = Mage::getConfig()->getModelClassName('ecomdev_layoutcompiler/layout_item_action');
$factory->setDefaultConstructorArguments('compiler_parser_handle', ['EcomDev_LayoutCompiler_Layout_Item_Include'])->setDefaultConstructorArguments('compiler_parser_remove', ['EcomDev_LayoutCompiler_Layout_Item_Remove'])->setDefaultConstructorArguments('compiler_parser_block', ['EcomDev_LayoutCompiler_Layout_Item_Block'])->setDefaultConstructorArguments('compiler_parser_action', [$itemActionClass]);
Mage::dispatchEvent('ecomdev_layoutcompiler_observer_parsers_init_before', ['factory' => $factory]);
$data = new stdClass();
$data->metadata_factory = $factory->createInstance('compiler_metadata_factory');
$data->parsers = ['update' => $factory->createInstance('compiler_parser_handle'), 'reference' => $factory->createInstance('compiler_parser_reference'), 'remove' => $factory->createInstance('compiler_parser_remove'), 'block' => $factory->createInstance('compiler_parser_block'), 'action' => $factory->createInstance('compiler_parser_action')];
Mage::dispatchEvent('ecomdev_layoutcompiler_observer_parsers_init_after', ['factory' => $factory, 'data' => $data]);
$factory->setDefaultConstructorArguments('compiler', [(array) $data])->setDependencyInjectionInstruction('EcomDev_LayoutCompiler_Contract_LayoutAwareInterface', 'setLayout', $observer->getLayout())->setDependencyInjectionInstruction('EcomDev_LayoutCompiler_Contract_CacheAwareInterface', 'setCache', Mage::getModel('ecomdev_layoutcompiler/cache'));
}
示例9: controller_action_layout_generate_blocks_after
/**
* Change product or category page titles
*
* @pram Varien_Event_Observer $observer
* @return ReeCreate_PageTitle_Model_Observer
*/
public function controller_action_layout_generate_blocks_after(Varien_Event_Observer $observer)
{
$head = $observer->getLayout()->getBlock('head');
if (Mage::registry('current_product')) {
$title = Mage::registry('current_product')->getName();
}
if (Mage::registry('current_category') && empty($title)) {
$title = Mage::registry('current_category')->getName();
}
if (!empty($title)) {
$head->setTitle($title);
}
}
示例10: beforeGenerateBlocks
public function beforeGenerateBlocks(Varien_Event_Observer $observer)
{
if (Mage::getSingleton('core/design_package')->getPackageName() == 'em0122' && Mage::getDesign()->getTheme('frontend') == 'default') {
# Disable default magento navigation
if (Mage::helper('themeframework/settings')->getGeneral_DisableDefaultNav() != 1 && Mage::getConfig()->getModuleConfig('EM_Megamenupro')->is('active', 'true')) {
$blocks = $observer->getLayout()->getXpath('//block[@name="em0122.catalog.topnav"]');
if (!empty($blocks)) {
$blocks[0]->addAttribute('ignore', true);
}
$blocks = $observer->getLayout()->getXpath('//block[@name="em0122.catalog.topnav.mobile"]');
if (!empty($blocks)) {
$blocks[0]->addAttribute('ignore', true);
}
}
# Disable EM variation module on frontend
if (Mage::helper('themeframework/settings')->getGeneral_DisableFrontendVariation() != 1 || Mage::helper('themeframework/settings')->checkMobile() == 'true') {
$blocks = $observer->getLayout()->getXpath('//block[@name="em_variation_tpl" or @name="color_variation"]');
foreach ($blocks as $block) {
$block->addAttribute('ignore', true);
}
}
# Disable default Magento footer links
if (Mage::helper('themeframework/settings')->getGeneral_DisableFooterLinks() != 1) {
$blocks = $observer->getLayout()->getXpath('//block[@name="cms_footer_links" or @name="footer_links"]');
foreach ($blocks as $block) {
$block->addAttribute('ignore', true);
}
}
# Disable Admin Toolbar
if (Mage::helper('themeframework/settings')->getGeneral_AdminToolbar() != 1) {
$blocks = $observer->getLayout()->getXpath('//block[@name="em_admin_toolbar"]');
foreach ($blocks as $block) {
$block->addAttribute('ignore', true);
}
}
}
}
示例11: beforeGenerateBlocks
public function beforeGenerateBlocks(Varien_Event_Observer $observer)
{
# Disable default magento navigation
if (Mage::helper('em0072settings')->getGeneral_DisableDefaultNav()) {
$blocks = $observer->getLayout()->getXpath('//block[@name="tensite.catalog.topnav"]');
if (!empty($blocks)) {
$blocks[0]->addAttribute('ignore', true);
}
}
# Disable EM variation module on frontend
if (Mage::helper('em0072settings')->getGeneral_DisableFrontendVariation()) {
$blocks = $observer->getLayout()->getXpath('//block[@name="em_variation_tpl" or @name="mobile_view"]');
foreach ($blocks as $block) {
$block->addAttribute('ignore', true);
}
}
# Disable default Magento footer links
if (Mage::helper('em0072settings')->getGeneral_DisableFooterLinks()) {
$blocks = $observer->getLayout()->getXpath('//block[@name="footer_links"]');
if (!empty($blocks)) {
$blocks[0]->addAttribute('ignore', true);
}
}
}
示例12: addActivationLayoutHandles
/**
* Adds layout handles based on configuration.
*
* @param Varien_Event_Observer $observer
*/
public function addActivationLayoutHandles($observer)
{
$request = Mage::app()->getRequest();
if (Mage::helper('hackathon_productdnd')->isActivated() && $request->getModuleName() == 'catalog' && $request->getControllerName() == 'category' && $request->getActionName() == 'view' && Mage::getBlockSingleton('catalog/product_list_toolbar')->getCurrentOrder() == 'position') {
$category = Mage::getSingleton('catalog/layer')->getCurrentCategory();
$layout = $observer->getLayout();
$update = $layout->getUpdate();
// sorting is not available if category is anchor and include child categories
if ($category->getIsAnchor() && count($category->getChildrenCategories()) > 0) {
$update->addHandle('hackathon_productdnd_inactive');
return;
}
$update->addHandle('hackathon_productdnd_enabled');
}
}
示例13: emptyCart
/**
* Empty shopping cart
*
* @param Varien_Event_Observer $observer
* @return H5mag_ShopApi_Model_Order_Observer
*/
public function emptyCart($observer)
{
$controller = $observer->getAction();
if ($controller instanceof Mage_Checkout_OnepageController) {
$action = $controller->getFullActionName();
if ($action == 'checkout_onepage_success') {
$layout = $observer->getLayout();
$layout->getUpdate()->addUpdate('
<reference name="content">
<block name="shopapi.cart" type="core/template" template="h5mag/shopapi/emptycart.phtml">
</block>
</reference>
');
}
}
return $this;
}
示例14: addHandles
/**
* Add ho_ajax handles
* @event controller_action_layout_load_before
* @param Varien_Event_Observer $event
*/
public function addHandles(Varien_Event_Observer $event)
{
if (!($core = $this->_getCore()->isHoAjax())) {
return;
}
/** @var Mage_Core_Model_Layout_Update $update */
$update = $event->getLayout()->getUpdate();
$request = Mage::app()->getRequest();
$handles = $update->getHandles();
$update->resetHandles();
// load action handle
$fullActionName = strtolower($request->getRequestedRouteName() . '_' . $request->getRequestedControllerName() . '_' . $request->getRequestedActionName());
foreach ($handles as $handle) {
$update->addHandle($handle);
if ($handle == 'default') {
$update->addHandle('ho_ajax');
}
if ($handle == $fullActionName) {
$update->addHandle('ho_ajax_' . $fullActionName);
}
}
}
示例15: addLayoutHandle
/**
* Detect which checkout is in use and add a new layout handle
*
* @param Varien_Event_Observer $observer
*
* @return $this
*/
public function addLayoutHandle(Varien_Event_Observer $observer)
{
/* @var $action Mage_Core_Controller_Varien_Action */
$action = $observer->getAction();
/* @var $layout Mage_Core_Model_Layout */
$layout = $observer->getLayout();
// We only want to run this action on the checkout
if ($action->getFullActionName() == 'checkout_onepage_index') {
// Attempt to detect Amasty_Scheckout
if (Mage::helper('core')->isModuleEnabled('Amasty_Scheckout')) {
$layout->getUpdate()->addHandle('amasty_onestep_checkout');
}
// Attempt to detect Unicode OP Checkout
if (Mage::helper('core')->isModuleEnabled('Uni_Opcheckout') && Mage::helper('opcheckout')->isActive()) {
$layout->getUpdate()->addHandle('unicode_onestep_checkout');
}
// Detect the Oye one step checkout
if (Mage::helper('core')->isModuleEnabled('Oye_Checkout') && Mage::helper('oyecheckout')->isOneStepLayout()) {
$layout->getUpdate()->addHandle('oye_onestep_checkout');
}
}
// As some 3rd party checkouts use the same handles, and URL we have to dynamically add new handles
if ($action->getFullActionName() == 'onestepcheckout_index_index') {
// Attempt to detect Magestore_Onestepcheckout
if (Mage::helper('core')->isModuleEnabled('Magestore_Onestepcheckout')) {
if (Mage::helper('onestepcheckout')->enabledOnestepcheckout()) {
$layout->getUpdate()->addHandle('magestore_onestepcheckout_index');
}
}
// Attempt to detect Idev_OneStepCheckout
if (Mage::helper('core')->isModuleEnabled('Idev_OneStepCheckout')) {
$layout->getUpdate()->addHandle('idev_onestepcheckout_index');
}
}
return $this;
}