Version Notes
Distributed under the OSL-3.0 license.
Download this release
Release Info
Developer | Solide Webservices |
Extension | SolideWebservices_CustomLayoutHandles |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/SolideWebservices/CustomLayoutHandles/Helper/Data.php +70 -0
- app/code/community/SolideWebservices/CustomLayoutHandles/Model/Observer.php +65 -0
- app/code/community/SolideWebservices/CustomLayoutHandles/etc/adminhtml.xml +32 -0
- app/code/community/SolideWebservices/CustomLayoutHandles/etc/config.xml +68 -0
- app/code/community/SolideWebservices/CustomLayoutHandles/etc/system.xml +156 -0
- app/design/adminhtml/default/default/layout/customlayouthandles.xml +15 -0
- app/design/frontend/base/default/layout/customlayouthandles.xml +16 -0
- app/etc/modules/SolideWebservices_CustomLayoutHandles.xml +15 -0
- app/locale/en_US/SolideWebservices_CustomLayoutHandles.csv +17 -0
- package.xml +18 -0
- skin/adminhtml/default/default/customlayouthandles/customlayouthandles.css +25 -0
app/code/community/SolideWebservices/CustomLayoutHandles/Helper/Data.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Solide Webservices
|
4 |
+
* @package CustomLayoutHandles
|
5 |
+
*/
|
6 |
+
|
7 |
+
class SolideWebservices_CustomLayoutHandles_Helper_Data extends Mage_Core_Helper_Abstract {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Determine whether the extension is enabled
|
11 |
+
*
|
12 |
+
* @return bool
|
13 |
+
*/
|
14 |
+
public function isEnabled() {
|
15 |
+
return Mage::getStoreConfig('customlayouthandles/settings/enabled');
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Determine whether to add xml handle for module
|
20 |
+
*
|
21 |
+
* @return bool
|
22 |
+
*/
|
23 |
+
public function addModuleXml() {
|
24 |
+
return Mage::getStoreConfig('customlayouthandles/settings/add_module_xml');
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Determine whether to add xml handle for cms title
|
29 |
+
*
|
30 |
+
* @return bool
|
31 |
+
*/
|
32 |
+
public function addCmsXml() {
|
33 |
+
return Mage::getStoreConfig('customlayouthandles/settings/add_cms_xml');
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Determine whether to add xml handle for cms title
|
38 |
+
*
|
39 |
+
* @return bool
|
40 |
+
*/
|
41 |
+
public function addCatNameXml() {
|
42 |
+
return Mage::getStoreConfig('customlayouthandles/settings/add_catname_xml');
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Determine whether to add xml handle for cms title
|
47 |
+
*
|
48 |
+
* @return bool
|
49 |
+
*/
|
50 |
+
public function addCatLevelXml() {
|
51 |
+
return Mage::getStoreConfig('customlayouthandles/settings/add_catlevel_xml');
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Determine whether to add xml handle for catergory fertility
|
56 |
+
*
|
57 |
+
* @return bool
|
58 |
+
*/
|
59 |
+
public function addFertilityXml() {
|
60 |
+
return Mage::getStoreConfig('customlayouthandles/settings/add_catfertility_xml');
|
61 |
+
}
|
62 |
+
|
63 |
+
/* return the current module as body class if enabled */
|
64 |
+
public function getModuleClass() {
|
65 |
+
if(Mage::getStoreConfig('customlayouthandles/settings/add_module_body')){
|
66 |
+
return 'module-' . Mage::app()->getFrontController()->getRequest()->getModuleName();
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
}
|
app/code/community/SolideWebservices/CustomLayoutHandles/Model/Observer.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Solide Webservices
|
4 |
+
* @package CustomLayoutHandles
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
|
8 |
+
class SolideWebservices_CustomLayoutHandles_Model_Observer {
|
9 |
+
|
10 |
+
public function customLayoutHandles(Varien_Event_Observer $observer) {
|
11 |
+
|
12 |
+
if (Mage::helper('customlayouthandles')->isEnabled() == 1) {
|
13 |
+
|
14 |
+
$layout = $observer->getEvent()->getLayout();
|
15 |
+
|
16 |
+
/* add xml handle module */
|
17 |
+
if (Mage::helper('customlayouthandles')->addModuleXml() == 1) {
|
18 |
+
$handle_module = Mage::app()->getFrontController()->getRequest()->getModuleName();
|
19 |
+
if($handle_module) {
|
20 |
+
$custom_handle_module = str_replace('/', '-', $handle_module);
|
21 |
+
$layout->getUpdate()->addHandle('module_'.$custom_handle_module);
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
/* add xml handle cms page title */
|
26 |
+
if (Mage::helper('customlayouthandles')->addCmsXml() == 1) {
|
27 |
+
$handle_cms = Mage::getSingleton('cms/page')->getIdentifier();
|
28 |
+
if($handle_cms) {
|
29 |
+
$custom_handle_cms = str_replace('/', '-', $handle_cms);
|
30 |
+
$layout->getUpdate()->addHandle('cms_'.$custom_handle_cms);
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
/* category handles */
|
35 |
+
$category = Mage::registry('current_category');
|
36 |
+
$product = Mage::registry('current_product');
|
37 |
+
|
38 |
+
/* add category name */
|
39 |
+
if (Mage::helper('customlayouthandles')->addCatNameXml() == 1) {
|
40 |
+
if ($category){
|
41 |
+
$slug = $category->getUrlKey();
|
42 |
+
$layout->getUpdate()->addHandle('catalog-category-'. $slug);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
/* add category level */
|
47 |
+
if (Mage::helper('customlayouthandles')->addCatLevelXml() == 1) {
|
48 |
+
if ($category && !$product) {
|
49 |
+
$layout->getUpdate()->addHandle('catalog_category_level_'.$category->getLevel());
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
/* has childeren or not */
|
54 |
+
if (Mage::helper('customlayouthandles')->addFertilityXml() == 1) {
|
55 |
+
if ($category instanceof Mage_Catalog_Model_Category) {
|
56 |
+
$fertility = (count($category->getChildrenCategories())) ? 'parent' : 'nochildren';
|
57 |
+
$layout->getUpdate()->addHandle('catalog_category_' . $fertility);
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
}
|
app/code/community/SolideWebservices/CustomLayoutHandles/etc/adminhtml.xml
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Solide Webservices
|
5 |
+
* @package CustomLayoutHandles
|
6 |
+
*/
|
7 |
+
-->
|
8 |
+
<config>
|
9 |
+
<acl>
|
10 |
+
<resources>
|
11 |
+
<all>
|
12 |
+
<title>Allow Everything</title>
|
13 |
+
</all>
|
14 |
+
<admin>
|
15 |
+
<children>
|
16 |
+
<system>
|
17 |
+
<children>
|
18 |
+
<config>
|
19 |
+
<children>
|
20 |
+
<customlayouthandles translate="title" module="customlayouthandles">
|
21 |
+
<title>Custom Layout Handles</title>
|
22 |
+
<sort_order>1</sort_order>
|
23 |
+
</customlayouthandles>
|
24 |
+
</children>
|
25 |
+
</config>
|
26 |
+
</children>
|
27 |
+
</system>
|
28 |
+
</children>
|
29 |
+
</admin>
|
30 |
+
</resources>
|
31 |
+
</acl>
|
32 |
+
</config>
|
app/code/community/SolideWebservices/CustomLayoutHandles/etc/config.xml
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Solide Webservices
|
5 |
+
* @package CustomLayoutHandles
|
6 |
+
*/
|
7 |
+
-->
|
8 |
+
<config>
|
9 |
+
<modules>
|
10 |
+
<SolideWebservices_CustomLayoutHandles>
|
11 |
+
<version>1.0.0</version>
|
12 |
+
</SolideWebservices_CustomLayoutHandles>
|
13 |
+
</modules>
|
14 |
+
<global>
|
15 |
+
<helpers>
|
16 |
+
<customlayouthandles>
|
17 |
+
<class>SolideWebservices_CustomLayoutHandles_Helper</class>
|
18 |
+
</customlayouthandles>
|
19 |
+
</helpers>
|
20 |
+
<blocks>
|
21 |
+
<customlayouthandles>
|
22 |
+
<class>SolideWebservices_CustomLayoutHandles_Block</class>
|
23 |
+
</customlayouthandles>
|
24 |
+
</blocks>
|
25 |
+
<events>
|
26 |
+
<controller_action_layout_load_before>
|
27 |
+
<observers>
|
28 |
+
<customlayouthandles_controller_action_layout_load_before>
|
29 |
+
<type>singleton</type>
|
30 |
+
<class>SolideWebservices_CustomLayoutHandles_Model_Observer</class>
|
31 |
+
<method>customLayoutHandles</method>
|
32 |
+
</customlayouthandles_controller_action_layout_load_before>
|
33 |
+
</observers>
|
34 |
+
</controller_action_layout_load_before>
|
35 |
+
</events>
|
36 |
+
</global>
|
37 |
+
<adminhtml>
|
38 |
+
<layout>
|
39 |
+
<updates>
|
40 |
+
<customlayouthandles>
|
41 |
+
<file>customlayouthandles.xml</file>
|
42 |
+
</customlayouthandles>
|
43 |
+
</updates>
|
44 |
+
</layout>
|
45 |
+
</adminhtml>
|
46 |
+
<frontend>
|
47 |
+
<layout>
|
48 |
+
<updates>
|
49 |
+
<customlayouthandles>
|
50 |
+
<file>customlayouthandles.xml</file>
|
51 |
+
</customlayouthandles>
|
52 |
+
</updates>
|
53 |
+
</layout>
|
54 |
+
</frontend>
|
55 |
+
<default>
|
56 |
+
<customlayouthandles>
|
57 |
+
<settings>
|
58 |
+
<enabled>1</enabled>
|
59 |
+
<add_module_xml>1</add_module_xml>
|
60 |
+
<add_cms_xml>1</add_cms_xml>
|
61 |
+
<add_catname_xml>1</add_catname_xml>
|
62 |
+
<add_catlevel_xml>1</add_catlevel_xml>
|
63 |
+
<add_catfertility_xml>1</add_catfertility_xml>
|
64 |
+
<add_module_body>1</add_module_body>
|
65 |
+
</settings>
|
66 |
+
</customlayouthandles>
|
67 |
+
</default>
|
68 |
+
</config>
|
app/code/community/SolideWebservices/CustomLayoutHandles/etc/system.xml
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Solide Webservices
|
5 |
+
* @package CustomLayoutHandles
|
6 |
+
*/
|
7 |
+
-->
|
8 |
+
<config>
|
9 |
+
<tabs>
|
10 |
+
<solidewebservices translate="label">
|
11 |
+
<label>Solide Webservices</label>
|
12 |
+
<sort_order>200</sort_order>
|
13 |
+
</solidewebservices>
|
14 |
+
</tabs>
|
15 |
+
<sections>
|
16 |
+
<customlayouthandles translate="label" module="customlayouthandles">
|
17 |
+
<label>Custom Layout Handles</label>
|
18 |
+
<tab>solidewebservices</tab>
|
19 |
+
<frontend_type>text</frontend_type>
|
20 |
+
<sort_order>100</sort_order>
|
21 |
+
<show_in_default>1</show_in_default>
|
22 |
+
<show_in_website>1</show_in_website>
|
23 |
+
<show_in_store>1</show_in_store>
|
24 |
+
<groups>
|
25 |
+
<settings translate="label">
|
26 |
+
<label>Settings</label>
|
27 |
+
<frontend_type>text</frontend_type>
|
28 |
+
<sort_order>100</sort_order>
|
29 |
+
<show_in_default>1</show_in_default>
|
30 |
+
<show_in_website>1</show_in_website>
|
31 |
+
<show_in_store>1</show_in_store>
|
32 |
+
<fields>
|
33 |
+
<option_divider_general_settings translate="label">
|
34 |
+
<label>General Settings</label>
|
35 |
+
<frontend_type>hidden</frontend_type>
|
36 |
+
<sort_order>101</sort_order>
|
37 |
+
<show_in_default>1</show_in_default>
|
38 |
+
<show_in_website>0</show_in_website>
|
39 |
+
<show_in_store>0</show_in_store>
|
40 |
+
</option_divider_general_settings>
|
41 |
+
<enabled translate="label comment">
|
42 |
+
<label>Enable Extension</label>
|
43 |
+
<comment><![CDATA[Enable the extension and add the selected layout handles.]]></comment>
|
44 |
+
<frontend_type>select</frontend_type>
|
45 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
46 |
+
<sort_order>102</sort_order>
|
47 |
+
<show_in_default>1</show_in_default>
|
48 |
+
<show_in_website>1</show_in_website>
|
49 |
+
<show_in_store>1</show_in_store>
|
50 |
+
</enabled>
|
51 |
+
<option_divider_xml_layout translate="label">
|
52 |
+
<label>XML Layout Handles</label>
|
53 |
+
<frontend_type>hidden</frontend_type>
|
54 |
+
<sort_order>103</sort_order>
|
55 |
+
<show_in_default>1</show_in_default>
|
56 |
+
<show_in_website>0</show_in_website>
|
57 |
+
<show_in_store>0</show_in_store>
|
58 |
+
<depends>
|
59 |
+
<enabled>1</enabled>
|
60 |
+
</depends>
|
61 |
+
</option_divider_xml_layout>
|
62 |
+
<add_module_xml translate="label comment">
|
63 |
+
<label>Add Module Layout Handle</label>
|
64 |
+
<comment><![CDATA[Add a XML handle for the viewed module, e.g. <module_customer>]]></comment>
|
65 |
+
<frontend_type>select</frontend_type>
|
66 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
67 |
+
<sort_order>104</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>1</show_in_store>
|
71 |
+
<depends>
|
72 |
+
<enabled>1</enabled>
|
73 |
+
</depends>
|
74 |
+
</add_module_xml>
|
75 |
+
<add_cms_xml translate="label comment">
|
76 |
+
<label>Add CMS Title Layout Handle</label>
|
77 |
+
<comment><![CDATA[Add a XML handle for the title of the viewed CMS page, e.g. <cms_about>]]></comment>
|
78 |
+
<frontend_type>select</frontend_type>
|
79 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
80 |
+
<sort_order>105</sort_order>
|
81 |
+
<show_in_default>1</show_in_default>
|
82 |
+
<show_in_website>1</show_in_website>
|
83 |
+
<show_in_store>1</show_in_store>
|
84 |
+
<depends>
|
85 |
+
<enabled>1</enabled>
|
86 |
+
</depends>
|
87 |
+
</add_cms_xml>
|
88 |
+
<add_catname_xml translate="label comment">
|
89 |
+
<label>Add Category Name Layout Handle</label>
|
90 |
+
<comment><![CDATA[Add a XML handle for the viewed category based on the URL slug of that category, e.g. <catalog-category-mens-clothes>]]></comment>
|
91 |
+
<frontend_type>select</frontend_type>
|
92 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
93 |
+
<sort_order>106</sort_order>
|
94 |
+
<show_in_default>1</show_in_default>
|
95 |
+
<show_in_website>1</show_in_website>
|
96 |
+
<show_in_store>1</show_in_store>
|
97 |
+
<depends>
|
98 |
+
<enabled>1</enabled>
|
99 |
+
</depends>
|
100 |
+
</add_catname_xml>
|
101 |
+
<add_catlevel_xml translate="label comment">
|
102 |
+
<label>Add Category Level Layout Handle</label>
|
103 |
+
<comment><![CDATA[Add a XML handle for the level of the viewed category which can then be used in layout XML files, e.g. <catalog_category_level_2>]]></comment>
|
104 |
+
<frontend_type>select</frontend_type>
|
105 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
106 |
+
<sort_order>107</sort_order>
|
107 |
+
<show_in_default>1</show_in_default>
|
108 |
+
<show_in_website>1</show_in_website>
|
109 |
+
<show_in_store>1</show_in_store>
|
110 |
+
<depends>
|
111 |
+
<enabled>1</enabled>
|
112 |
+
</depends>
|
113 |
+
</add_catlevel_xml>
|
114 |
+
<add_catfertility_xml translate="label comment">
|
115 |
+
<label>Add Category Fertility Handle</label>
|
116 |
+
<comment><![CDATA[Add a XML handle that indicates if a category has children can then be used in layout XML files, e.g. <catalog_category_parent or catalog_category_nochilderen>]]></comment>
|
117 |
+
<frontend_type>select</frontend_type>
|
118 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
119 |
+
<sort_order>108</sort_order>
|
120 |
+
<show_in_default>1</show_in_default>
|
121 |
+
<show_in_website>1</show_in_website>
|
122 |
+
<show_in_store>1</show_in_store>
|
123 |
+
<depends>
|
124 |
+
<enabled>1</enabled>
|
125 |
+
</depends>
|
126 |
+
</add_catfertility_xml>
|
127 |
+
<option_divider_body_classes translate="label">
|
128 |
+
<label>Body Classes</label>
|
129 |
+
<frontend_type>hidden</frontend_type>
|
130 |
+
<sort_order>109</sort_order>
|
131 |
+
<show_in_default>1</show_in_default>
|
132 |
+
<show_in_website>0</show_in_website>
|
133 |
+
<show_in_store>0</show_in_store>
|
134 |
+
<depends>
|
135 |
+
<enabled>1</enabled>
|
136 |
+
</depends>
|
137 |
+
</option_divider_body_classes>
|
138 |
+
<add_module_body translate="label comment">
|
139 |
+
<label>Add Module To Body Classes</label>
|
140 |
+
<comment><![CDATA[Add a CSS body class for the viewed module which can then be used in stylesheets, e.g. .module-customer]]></comment>
|
141 |
+
<frontend_type>select</frontend_type>
|
142 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
143 |
+
<sort_order>110</sort_order>
|
144 |
+
<show_in_default>1</show_in_default>
|
145 |
+
<show_in_website>1</show_in_website>
|
146 |
+
<show_in_store>1</show_in_store>
|
147 |
+
<depends>
|
148 |
+
<enabled>1</enabled>
|
149 |
+
</depends>
|
150 |
+
</add_module_body>
|
151 |
+
</fields>
|
152 |
+
</settings>
|
153 |
+
</groups>
|
154 |
+
</customlayouthandles>
|
155 |
+
</sections>
|
156 |
+
</config>
|
app/design/adminhtml/default/default/layout/customlayouthandles.xml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<!--
|
4 |
+
/**
|
5 |
+
* @category Solide Webservices
|
6 |
+
* @package CustomLayoutHandles
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<adminhtml_system_config_edit>
|
10 |
+
<reference name="head">
|
11 |
+
<action method="addCss"><stylesheet>customlayouthandles/customlayouthandles.css</stylesheet></action>
|
12 |
+
</reference>
|
13 |
+
</adminhtml_system_config_edit>
|
14 |
+
|
15 |
+
</layout>
|
app/design/frontend/base/default/layout/customlayouthandles.xml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Solide Webservices
|
5 |
+
* @package CustomLayoutHandles
|
6 |
+
*/
|
7 |
+
-->
|
8 |
+
<layout version="0.1.0">
|
9 |
+
<default>
|
10 |
+
<reference name="root">
|
11 |
+
<action method="addBodyClass" ifconfig="customlayouthandles/settings/enabled">
|
12 |
+
<className helper="customlayouthandles/getModuleClass" />
|
13 |
+
</action>
|
14 |
+
</reference>
|
15 |
+
</default>
|
16 |
+
</layout>
|
app/etc/modules/SolideWebservices_CustomLayoutHandles.xml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Solide Webservices
|
5 |
+
* @package CustomLayoutHandles
|
6 |
+
*/
|
7 |
+
-->
|
8 |
+
<config>
|
9 |
+
<modules>
|
10 |
+
<SolideWebservices_CustomLayoutHandles>
|
11 |
+
<active>true</active>
|
12 |
+
<codePool>community</codePool>
|
13 |
+
</SolideWebservices_CustomLayoutHandles>
|
14 |
+
</modules>
|
15 |
+
</config>
|
app/locale/en_US/SolideWebservices_CustomLayoutHandles.csv
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"General Settings","General Settings"
|
2 |
+
"Enable Extension","Enable Extension"
|
3 |
+
"Enable the extension and add the selected layout handles.","Enable the extension and add the selected layout handles."
|
4 |
+
"XML Layout Handles","XML Layout Handles"
|
5 |
+
"Add Module Layout Handle","Add Module Layout Handle"
|
6 |
+
"Add a XML handle for the viewed module, e.g. <module_customer>","Add a XML handle for the viewed module, e.g. <module_customer>"
|
7 |
+
"Add CMS Title Layout Handle","Add CMS Title Layout Handle"
|
8 |
+
"Add a XML handle for the title of the viewed CMS page, e.g. <cms_about>","Add a XML handle for the title of the viewed CMS page, e.g. <cms_about>"
|
9 |
+
"Add Category Name Layout Handle","Add Category Name Layout Handle"
|
10 |
+
"Add a XML handle for the viewed category based on the URL slug of that category, e.g. <catalog-category-mens-clothes>","Add a XML handle for the viewed category based on the URL slug of that category, e.g. <catalog-category-mens-clothes>"
|
11 |
+
"Add Category Level Layout Handle","Add Category Level Layout Handle"
|
12 |
+
"Add a XML handle for the level of the viewed category which can then be used in layout XML files, e.g. <catalog_category_level_2>","Add a XML handle for the level of the viewed category which can then be used in layout XML files, e.g. <catalog_category_level_2>"
|
13 |
+
"Add Category Fertility Handle","Add Category Fertility Handle"
|
14 |
+
"Add a XML handle that indicates if a category has children can then be used in layout XML files, e.g. <catalog_category_parent or catalog_category_nochilderen>","Add a XML handle that indicates if a category has children can then be used in layout XML files, e.g. <catalog_category_parent or catalog_category_nochilderen>"
|
15 |
+
"Body Classes","Body Classes"
|
16 |
+
"Add Module To Body Classes","Add Module To Body Classes"
|
17 |
+
"Add a CSS body class for the viewed module which can then be used in stylesheets, e.g. .module-customer","Add a CSS body class for the viewed module which can then be used in stylesheets, e.g. .module-customer"
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>SolideWebservices_CustomLayoutHandles</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/OSL-3.0">Open Software License v. 3.0 (OSL-3.0)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This extension has the ability to add various XML Layout handles or body classes which can then be used in the customized themes.</summary>
|
10 |
+
<description>This extension has the ability to add various XML Layout handles or body classes which can then be used in the customized themes. It can for example add XML Layout handles for various category related information or the currently loaded module.</description>
|
11 |
+
<notes>Distributed under the OSL-3.0 license.</notes>
|
12 |
+
<authors><author><name>Solide Webservices</name><user>Solide</user><email>contact@solidewebservices.com</email></author></authors>
|
13 |
+
<date>2014-02-26</date>
|
14 |
+
<time>20:10:56</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="SolideWebservices"><dir name="CustomLayoutHandles"><dir name="Helper"><file name="Data.php" hash="8aaff4ada167790ce4e3b00a0a9c8bec"/></dir><dir name="Model"><file name="Observer.php" hash="e062442b24b118e9d7bbaaf38fb4550e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="6c1c7cf0bd8af13684828bb49e062950"/><file name="config.xml" hash="d35341ce328b37db8a79b5cffbb86a01"/><file name="system.xml" hash="dfb487c5c4a490aa6f16c058d0f696c8"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="customlayouthandles.xml" hash="c015c5cbc34baac1543a10439fb80530"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="customlayouthandles.xml" hash="5d93dbfeb63999b2f32c7e432f7a1490"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SolideWebservices_CustomLayoutHandles.xml" hash="c08456dbe754641640a7c9b3a335b0ed"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="customlayouthandles"><file name="customlayouthandles.css" hash="8f11ac11dfd913d71531576ca2fd819e"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="SolideWebservices_CustomLayoutHandles.csv" hash="53d54b19aea65ba5ebaf6469b74fe746"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|
skin/adminhtml/default/default/customlayouthandles/customlayouthandles.css
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#customlayouthandles_settings .form-list td { padding-top: 10px !important; padding-bottom: 10px !important; }
|
2 |
+
#customlayouthandles_settings .form-list td.label { width: 250px; font-weight: bold; }
|
3 |
+
#customlayouthandles_settings .form-list td.label label { width: 235px; }
|
4 |
+
#customlayouthandles_settings .form-list td.value { width: 600px; }
|
5 |
+
#customlayouthandles_settings .form-list td.value select { width: 60px; }
|
6 |
+
#customlayouthandles_settings .form-list td.value p.note { width: 568px; }
|
7 |
+
#row_customlayouthandles_settings_option_divider_general_settings td,
|
8 |
+
#row_customlayouthandles_settings_option_divider_xml_layout td,
|
9 |
+
#row_customlayouthandles_settings_option_divider_body_classes td {
|
10 |
+
padding: 20px 0 10px !important;
|
11 |
+
}
|
12 |
+
#row_customlayouthandles_settings_option_divider_general_settings td label,
|
13 |
+
#row_customlayouthandles_settings_option_divider_xml_layout td label,
|
14 |
+
#row_customlayouthandles_settings_option_divider_body_classes td label {
|
15 |
+
background-color: #6F8992 !important;
|
16 |
+
font-weight: bold;
|
17 |
+
font-variant: small-caps;
|
18 |
+
color: #fff;
|
19 |
+
padding: 4px;
|
20 |
+
}
|
21 |
+
#row_customlayouthandles_settings_option_divider_general_settings td.scope-label,
|
22 |
+
#row_customlayouthandles_settings_option_divider_xml_layout td.scope-label,
|
23 |
+
#row_customlayouthandles_settings_option_divider_body_classes td.scope-label {
|
24 |
+
display: none;
|
25 |
+
}
|