diff --git a/module/VuFindTheme/src/VuFindTheme/View/Helper/HeadThemeResources.php b/module/VuFindTheme/src/VuFindTheme/View/Helper/HeadThemeResources.php index e38fc81a35f1bfe69f2e9129c7eaea583b212fcb..82b648f79ece123574bcb56d1a5f5bffd5c059e9 100644 --- a/module/VuFindTheme/src/VuFindTheme/View/Helper/HeadThemeResources.php +++ b/module/VuFindTheme/src/VuFindTheme/View/Helper/HeadThemeResources.php @@ -61,6 +61,19 @@ class HeadThemeResources extends \Zend\View\Helper\AbstractHelper * @return void */ public function __invoke() + { + // Add various types of content to the header: + $this->addMetaTags(); + $this->addLinks(); + $this->addScripts(); + } + + /** + * Add meta tags to header. + * + * @return void + */ + protected function addMetaTags() { // Set up encoding: $headMeta = $this->getView()->plugin('headmeta'); @@ -73,7 +86,15 @@ class HeadThemeResources extends \Zend\View\Helper\AbstractHelper if (!empty($generator)) { $headMeta()->appendName('Generator', $generator); } + } + /** + * Add links to header. + * + * @return void + */ + protected function addLinks() + { // Convenient shortcut to view helper: $headLink = $this->getView()->plugin('headlink'); @@ -94,6 +115,24 @@ class HeadThemeResources extends \Zend\View\Helper\AbstractHelper $headLink()->addLessStylesheet($current); } + // If we have a favicon, load it now: + $favicon = $this->container->getFavicon(); + if (!empty($favicon)) { + $imageLink = $this->getView()->plugin('imagelink'); + $headLink(array( + 'href' => $imageLink($favicon), + 'type' => 'image/x-icon', 'rel' => 'shortcut icon' + )); + } + } + + /** + * Add scripts to header. + * + * @return void + */ + protected function addScripts() + { // Load Javascript (same ordering considerations as CSS, above): $headScript = $this->getView()->plugin('headscript'); foreach (array_reverse($this->container->getJs()) as $current) { @@ -105,15 +144,5 @@ class HeadThemeResources extends \Zend\View\Helper\AbstractHelper ? array('conditional' => trim($parts[1])) : array() ); } - - // If we have a favicon, load it now: - $favicon = $this->container->getFavicon(); - if (!empty($favicon)) { - $imageLink = $this->getView()->plugin('imagelink'); - $headLink(array( - 'href' => $imageLink($favicon), - 'type' => 'image/x-icon', 'rel' => 'shortcut icon' - )); - } } }