Add missing HTML::script and HTML::style

This commit is contained in:
Maxime Fabre committed 2013-04-02 22:40:18 +03:00
1 parent 617756d715
commit 520d1e6d83
1 file changed
+32
+32
View File
@@ -63,6 +63,38 @@ class HtmlBuilder {
return html_entity_decode($value, ENT_QUOTES, 'UTF-8');
}
/**
* Generate a link to a JavaScript file.
*
* @param string $url
* @param array $attributes
* @return string
*/
public function script($url, $attributes = array())
{
$attributes['src'] = $this->url->asset($url);
return '<script'.$this->attributes($attributes).'></script>'.PHP_EOL;
}
/**
* Generate a link to a CSS file.
*
* @param string $url
* @param array $attributes
* @return string
*/
public function style($url, $attributes = array())
{
$defaults = array('media' => 'all', 'type' => 'text/css', 'rel' => 'stylesheet');
$attributes = $attributes + $defaults;
$attributes['href'] = $this->url->asset($url);
return '<link'.$this->attributes($attributes).'>'.PHP_EOL;
}
/**
* Generate an HTML image element.
*