allow rel and other stylesheet defaults to be overriden.

This commit is contained in:
Taylor Otwell 2011-10-08 19:55:57 -05:00
parent e366c62db1
commit c5c0ebc00a
1 changed files with 5 additions and 2 deletions

View File

@ -56,9 +56,12 @@ public static function script($url, $attributes = array())
*/
public static function style($url, $attributes = array())
{
if ( ! array_key_exists('media', $attributes)) $attributes['media'] = 'all';
$defaults = array('media' => 'all', 'type' => 'text/css', 'rel' => 'stylesheet');
$attributes = array_merge($attributes, array('rel' => 'stylesheet', 'type' => 'text/css'));
foreach ($defaults as $attribute => $default)
{
if ( ! array_key_exists($attribute, $attributes)) $attributes[$attribute] = $default;
}
return '<link href="'.static::entities(URL::to_asset($url)).'"'.static::attributes($attributes).'>'.PHP_EOL;
}