removed get_script and get_style from asset class.
This commit is contained in:
parent
d82a3f419f
commit
d252677f34
|
@ -197,7 +197,7 @@ protected function register($type, $name, $source, $dependencies, $attributes)
|
||||||
*/
|
*/
|
||||||
public function styles()
|
public function styles()
|
||||||
{
|
{
|
||||||
return $this->get_group('style');
|
return $this->group('style');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -207,7 +207,7 @@ public function styles()
|
||||||
*/
|
*/
|
||||||
public function scripts()
|
public function scripts()
|
||||||
{
|
{
|
||||||
return $this->get_group('script');
|
return $this->group('script');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -216,7 +216,7 @@ public function scripts()
|
||||||
* @param string $group
|
* @param string $group
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function get_group($group)
|
protected function group($group)
|
||||||
{
|
{
|
||||||
if ( ! isset($this->assets[$group]) or count($this->assets[$group]) == 0) return '';
|
if ( ! isset($this->assets[$group]) or count($this->assets[$group]) == 0) return '';
|
||||||
|
|
||||||
|
@ -224,34 +224,12 @@ protected function get_group($group)
|
||||||
|
|
||||||
foreach ($this->arrange($this->assets[$group]) as $name => $data)
|
foreach ($this->arrange($this->assets[$group]) as $name => $data)
|
||||||
{
|
{
|
||||||
$assets .= $this->get_asset($group, $name);
|
$assets .= $this->asset($group, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $assets;
|
return $assets;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the link to a single registered CSS asset.
|
|
||||||
*
|
|
||||||
* @param string $name
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function get_style($name)
|
|
||||||
{
|
|
||||||
return $this->get_asset('style', $name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the link to a single registered JavaScript asset.
|
|
||||||
*
|
|
||||||
* @param string $name
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function get_script($name)
|
|
||||||
{
|
|
||||||
return $this->get_asset('script', $name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the HTML link to a registered asset.
|
* Get the HTML link to a registered asset.
|
||||||
*
|
*
|
||||||
|
@ -259,7 +237,7 @@ public function get_script($name)
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function get_asset($group, $name)
|
protected function asset($group, $name)
|
||||||
{
|
{
|
||||||
if ( ! isset($this->assets[$group][$name])) return '';
|
if ( ! isset($this->assets[$group][$name])) return '';
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,6 @@ public function testAllStylesCanBeRetrievedViaStylesMethod()
|
||||||
$container->style('reset', 'css/reset.css');
|
$container->style('reset', 'css/reset.css');
|
||||||
$container->style('jquery', 'css/jquery.css');
|
$container->style('jquery', 'css/jquery.css');
|
||||||
|
|
||||||
$this->assertEquals($container->get_style('reset'), 'css/reset.css media:all');
|
|
||||||
$this->assertEquals($container->styles(), 'css/reset.css media:allcss/jquery.css media:all');
|
$this->assertEquals($container->styles(), 'css/reset.css media:allcss/jquery.css media:all');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +80,6 @@ public function testAllScriptsCanBeRetrievedViaScriptsMethod()
|
||||||
$container->script('jquery-ui', 'js/jquery-ui.js');
|
$container->script('jquery-ui', 'js/jquery-ui.js');
|
||||||
$container->script('jquery', 'js/jquery.js', array(), array('test' => 'value'));
|
$container->script('jquery', 'js/jquery.js', array(), array('test' => 'value'));
|
||||||
|
|
||||||
$this->assertEquals($container->get_script('jquery-ui'), 'js/jquery-ui.js ');
|
|
||||||
$this->assertEquals($container->scripts(), 'js/jquery-ui.js js/jquery.js test:value');
|
$this->assertEquals($container->scripts(), 'js/jquery-ui.js js/jquery.js test:value');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue