anewt-developers team mailing list archive
-
anewt-developers team
-
Mailing list archive
-
Message #00294
[Branch ~uws/anewt/anewt.uws] Rev 1805: [page] Add 'wrapper-div-class' property to AnewtPage
------------------------------------------------------------
revno: 1805
committer: Wouter Bolsterlee <uws@xxxxxxxxx>
branch nick: anewt
timestamp: Fri 2010-11-05 14:26:24 +0100
message:
[page] Add 'wrapper-div-class' property to AnewtPage
This is just like wrapper-div-id, but applies to the class
name attribute. This is useful for e.g. dynamically styled
pages where specific element styling lower in the tree can
inherit from the upper class (pun intended). Example: add
class name "blue" to the wrapper div from PHP, then use
selectors like ".blue h1 { color: blue }" in a CSS file.
modified:
page/module.doc.xml
page/page.lib.php
--
lp:anewt
https://code.launchpad.net/~uws/anewt/anewt.uws
Your team Anewt developers is subscribed to branch lp:anewt.
To unsubscribe from this branch go to https://code.launchpad.net/~uws/anewt/anewt.uws/+edit-subscription
=== modified file 'page/module.doc.xml'
--- page/module.doc.xml 2009-07-19 19:44:45 +0000
+++ page/module.doc.xml 2010-11-05 13:26:24 +0000
@@ -243,7 +243,10 @@
to <code>true</code>).
</anewt:property>
<anewt:property name="wrapper-div-id">
- The id of the wrapper div. Defaults to <code>wrapper</code>.
+ The id attribute of the wrapper div. Defaults to <code>wrapper</code>.
+ </anewt:property>
+ <anewt:property name="wrapper-div-class">
+ The class attribute of the wrapper div. Defaults to <code>null</code>.
</anewt:property>
</anewt:properties>
=== modified file 'page/page.lib.php'
--- page/page.lib.php 2010-02-16 19:39:38 +0000
+++ page/page.lib.php 2010-11-05 13:26:24 +0000
@@ -70,6 +70,7 @@
'use-wrapper-div' => true,
'wrapper-div-id' => 'wrapper',
+ 'wrapper-div-class' => null,
));
}
@@ -494,7 +495,13 @@
* invisible fragment (both XML nodes, so the API is the same). */
if ($this->_get('use-wrapper-div'))
+ {
$buffer = ax_div_id(null, $this->_get('wrapper-div-id'));
+
+ $wrapper_div_class = $this->_get('wrapper-div-class');
+ if (!is_null($wrapper_div_class))
+ $buffer->add_class($wrapper_div_class);
+ }
else
$buffer = ax_fragment();