Add plugin hooks for assets
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user