Skip to content
Snippets Groups Projects
Commit 615b38fe authored by Tim Steiner's avatar Tim Steiner
Browse files

Add support to the WdnTemplate for setting UNL_Templates::$options via application.ini

Use unl.templates.options.* to set these options.
parent a81ed7f6
Branches
No related tags found
No related merge requests found
<?php
/**
* Currently a helper class for accessing the Zend_Application instance.
* @author tsteiner
*/
class Unl_Application
{
/**
* Attempts to return the current application's configuration.
* If we're not running as a Zend_Application an empty array is returned.
*
* @return array
*/
static public function getOptions()
{
$application = self::getInstance();
if (!$application) {
return array();
}
return $application->getOptions();
}
/**
* Attempts to return the current Zend_Application instance.
* If we're not running as a Zend_Application, NULL is returned.
*
* @return Zend_Application
*/
static public function getInstance()
{
if (!class_exists('Zend_Controller_Front')) {
return NULL;
}
$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
if (!$bootstrap instanceof Zend_Application_Bootstrap_BootstrapAbstract) {
return NULL;
}
$application = $bootstrap->getApplication();
if (!$application instanceof Zend_Application) {
return NULL;
}
return $application;
}
}
...@@ -57,6 +57,12 @@ class Unl_View_Helper_WdnTemplate extends Zend_View_Helper_Abstract ...@@ -57,6 +57,12 @@ class Unl_View_Helper_WdnTemplate extends Zend_View_Helper_Abstract
require_once 'UNL/Templates.php'; require_once 'UNL/Templates.php';
Unl_Templates::$options['version'] = UNL_Templates::VERSION3; Unl_Templates::$options['version'] = UNL_Templates::VERSION3;
$config = Unl_Application::getOptions();
if (isset($config['unl']['templates']['options']) && is_array($config['unl']['templates']['options'])) {
UNL_Templates::$options = array_merge(UNL_Templates::$options, $config['unl']['templates']['options']);
}
$template = UNL_Templates::factory($layout->template, array('sharedcodepath' => 'sharedcode')); $template = UNL_Templates::factory($layout->template, array('sharedcodepath' => 'sharedcode'));
$template->titlegraphic = '<h1>' . $layout->siteTitle . '</h1>'; $template->titlegraphic = '<h1>' . $layout->siteTitle . '</h1>';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment