Add missing HTML::script and HTML::style
This commit is contained in:
1 parent
617756d715
commit
520d1e6d83
1 file changed
+32
@@ -63,6 +63,38 @@ class HtmlBuilder {
|
|||||||
return html_entity_decode($value, ENT_QUOTES, 'UTF-8');
|
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.
|
* Generate an HTML image element.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in new issue
Block a user