Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit ca18e78327b7d505cd873c59911bbd66480e55ca Fabrizio Branca committed Mar 12, 2012
@@ -0,0 +1,5 @@
+<?php
+
+class Aoe_LayoutConditions_Helper_Data extends Mage_Core_Helper_Abstract {
+
+}
@@ -0,0 +1,40 @@
+<?php
+
+class Aoe_LayoutConditions_Model_Layout extends Mage_Core_Model_Layout {
+
+ /**
+ * Create layout blocks hierarchy from layout xml configuration
+ *
+ * @param Mage_Core_Layout_Element|null $parent
+ */
+ public function generateBlocks($parent=null) {
+
+ if (empty($parent)) {
+ $parent = $this->getNode();
+ }
+
+ if (isset($parent['ifconfig']) && ($configPath = (string)$parent['ifconfig'])) {
+ if (!Mage::getStoreConfigFlag($configPath)) {
+ return;
+ }
+ }
+ parent::generateBlocks($parent);
+ }
+
+ /**
+ * Add block object to layout based on xml node data
+ *
+ * @param Varien_Simplexml_Element $node
+ * @param Varien_Simplexml_Element $parent
+ * @return Mage_Core_Model_Layout
+ */
+ protected function _generateBlock($node, $parent) {
+ if (isset($node['ifconfig']) && ($configPath = (string)$node['ifconfig'])) {
+ if (!Mage::getStoreConfigFlag($configPath)) {
+ return;
+ }
+ }
+ return parent::_generateBlock($node, $parent);
+ }
+
+}
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<config>
+ <modules>
+ <Aoe_LayoutConditions>
+ <version>0.1.0</version>
+ </Aoe_LayoutConditions>
+ </modules>
+
+ <global>
+ <helpers>
+ <aoe_layoutconditions>
+ <class>Aoe_LayoutConditions_Helper</class>
+ </aoe_layoutconditions>
+ </helpers>
+ <models>
+ <!--<aoe_layoutconditions>
+ <class>Aoe_LayoutConditions_Model</class>
+ </aoe_layoutconditions>-->
+ <core>
+ <rewrite>
+ <layout>Aoe_LayoutConditions_Model_Layout</layout>
+ </rewrite>
+ </core>
+ </models>
+ </global>
+
+</config>
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<config>
+ <modules>
+ <Aoe_LayoutConditions>
+ <codePool>local</codePool>
+ <active>true</active>
+ </Aoe_LayoutConditions>
+ </modules>
+</config>
2 modman
@@ -0,0 +1,2 @@
+app/etc/modules/* app/etc/modules/
+app/code/local/Aoe/LayoutConditions app/code/local/Aoe/LayoutConditions

0 comments on commit ca18e78

Please sign in to comment.