Skip to content
Snippets Groups Projects
Commit a594e0c9 authored by Demian Katz's avatar Demian Katz
Browse files

Decoupled LayoutClass helper from ConfigReader.

parent 2d026f8a
No related merge requests found
......@@ -27,7 +27,6 @@
* @link http://vufind.org/wiki/vufind2:developer_manual Wiki
*/
namespace VuFind\View\Helper\Blueprint;
use VuFind\Config\Reader as ConfigReader, Zend\View\Helper\AbstractHelper;
/**
* Helper class for managing blueprint theme's high-level (body vs. sidebar) page
......@@ -39,8 +38,25 @@ use VuFind\Config\Reader as ConfigReader, Zend\View\Helper\AbstractHelper;
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org/wiki/vufind2:developer_manual Wiki
*/
class LayoutClass extends AbstractHelper
class LayoutClass extends \Zend\View\Helper\AbstractHelper
{
/**
* Does the sidebar go on the left?
*
* @var bool
*/
protected $left;
/**
* Constructor
*
* @param bool $left Does the sidebar go on the left?
*/
public function __construct($left = false)
{
$this->left = $left;
}
/**
* Helper to allow easily configurable page layout -- given a broad class
* name, return appropriate CSS classes to lay out the page according to
......@@ -52,14 +68,11 @@ class LayoutClass extends AbstractHelper
*/
public function __invoke($class)
{
$config = ConfigReader::getConfig();
$left = !isset($config->Site->sidebarOnLeft)
? false : $config->Site->sidebarOnLeft;
switch ($class) {
case 'mainbody':
return $left ? 'span-18 push-5 last' : 'span-18';
return $this->left ? 'span-18 push-5 last' : 'span-18';
case 'sidebar':
return $left ? 'span-5 pull-18 sidebarOnLeft' : 'span-5 last';
return $this->left ? 'span-5 pull-18 sidebarOnLeft' : 'span-5 last';
default:
return '';
}
......
......@@ -21,8 +21,15 @@ return array(
),
'favicon' => 'vufind-favicon.ico',
'helpers' => array(
'factories' => array(
'layoutclass' => function ($sm) {
$config = \VuFind\Config\Reader::getConfig();
$left = !isset($config->Site->sidebarOnLeft)
? false : $config->Site->sidebarOnLeft;
return new \VuFind\View\Helper\Blueprint\LayoutClass($left);
},
),
'invokables' => array(
'layoutclass' => 'VuFind\View\Helper\Blueprint\LayoutClass',
'search' => 'VuFind\View\Helper\Blueprint\Search',
)
)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment