Skip to content
This repository has been archived by the owner on Sep 12, 2022. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabrizio Branca committed Mar 12, 2012
0 parents commit ca18e78
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/code/local/Aoe/LayoutConditions/Helper/Data.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

class Aoe_LayoutConditions_Helper_Data extends Mage_Core_Helper_Abstract {

}
40 changes: 40 additions & 0 deletions app/code/local/Aoe/LayoutConditions/Model/Layout.php
Original file line number Diff line number Diff line change
@@ -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);
}

}
27 changes: 27 additions & 0 deletions app/code/local/Aoe/LayoutConditions/etc/config.xml
Original file line number Diff line number Diff line change
@@ -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>
9 changes: 9 additions & 0 deletions app/etc/modules/Aoe_LayoutConditions.xml
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions modman
Original file line number Diff line number Diff line change
@@ -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.