diff options
author | Craig Andrews <candrews@integralblue.com> | 2009-12-04 20:19:55 -0500 |
---|---|---|
committer | Craig Andrews <candrews@integralblue.com> | 2009-12-04 20:19:55 -0500 |
commit | b3086d3c68ed2d3ceff3ce8fc91a867fc07c441a (patch) | |
tree | 263d505c6c6116c6f6343c8c3dfa85945558a9bb | |
parent | 7ddf911f5d54ba4997b3d237ae7cd1effb74a120 (diff) |
Add style function to output style() tags
Add 2 new events: StartStyleElement and EndStyleElement
-rw-r--r-- | EVENTS.txt | 12 | ||||
-rw-r--r-- | lib/htmloutputter.php | 21 |
2 files changed, 33 insertions, 0 deletions
diff --git a/EVENTS.txt b/EVENTS.txt index 678df8b0a..a056aa0a1 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -586,6 +586,18 @@ EndCssLinkElement: After a <link rel="stylesheet"..> element is written - $theme - $media +StartStyleElement: Before a <style...> element is written +- $action +- &$code +- &$type +- &$media + +EndStyleElement: After a <style...> element is written +- $action +- $code +- $type +- $media + StartScriptElement: Before a <script...> element is written - $action - &$src diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 0c2d18da3..a88a5b82c 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -419,6 +419,27 @@ class HTMLOutputter extends XMLOutputter } /** + * output a style (almost always css) tag with inline + * code. + * + * @param string $code code to put in the style tag + * @param string $type 'type' attribute value of the tag + * @param string $media 'media' attribute value of the tag + * + * @return void + */ + + function style($code, $type = 'text/css', $media = null) + { + if(Event::handle('StartStyleElement', array($this,&$code,&$type,&$media))) { + $this->elementStart('style', array('type' => $type, 'media' => $media)); + $this->raw($code); + $this->elementEnd('style'); + Event::handle('EndStyleElement', array($this,$code,$type,$media)); + } + } + + /** * output an HTML textarea and associated elements * * @param string $id element ID, must be unique on page |