Add plugin hooks for assets

This commit is contained in:
Frederic Guillot
2015-09-21 21:07:15 -04:00
parent 2cff1d6a37
commit 78ecdc05c3
4 changed files with 87 additions and 1 deletions

View File

@@ -10,6 +10,26 @@ namespace Helper;
*/
class Hook extends \Core\Base
{
/**
* Add assets JS or CSS
*
* @access public
* @param string $type
* @param string $hook
* @param array $variables
* @return string
*/
public function asset($type, $hook)
{
$buffer = '';
foreach ($this->hook->getListeners($hook) as $file) {
$buffer .= $this->helper->asset->$type($file);
}
return $buffer;
}
/**
* Render all attached hooks
*

View File

@@ -21,6 +21,9 @@
<?= $this->asset->css('assets/css/print.css', true, 'print') ?>
<?= $this->asset->customCss() ?>
<?= $this->hook->asset('css', 'template:layout:css') ?>
<?= $this->hook->asset('js', 'template:layout:js') ?>
<link rel="icon" type="image/png" href="<?= $this->url->dir() ?>assets/img/favicon.png">
<link rel="apple-touch-icon" href="<?= $this->url->dir() ?>assets/img/touch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="72x72" href="<?= $this->url->dir() ?>assets/img/touch-icon-ipad.png">