Add style function to output style() tags
Add 2 new events: StartStyleElement and EndStyleElement
This commit is contained in:
parent
7ddf911f5d
commit
b3086d3c68
12
EVENTS.txt
12
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
|
||||
|
@ -418,6 +418,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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user