Action_Helper_Sidebar::addSidebar PHP Method

addSidebar() public method

Add sidebar
public addSidebar ( array $config, boolean $prepend = false ) : void
$config array
$prepend boolean
return void
    public function addSidebar(array $config, $prepend = false)
    {
        // init
        $controller = $this->getActionController();
        $view = $controller->view;
        if (!empty($config['resource'])) {
            // check acl
            $acl = $controller->getHelper('acl');
            if (!$acl->isAllowed($config['resource'], $config['privilege'])) {
                return;
            }
        }
        // get config
        $params = $this->getRequest()->getParams();
        $config = array_merge($params, $config);
        ob_start();
        echo !empty($config['label']) ? '<h3 class="label">' . $config['label'] . "</h3>\n" : '';
        echo $view->action($config['action'], $config['controller'], $config['module'], $config);
        $content = ob_get_clean();
        $method = $prepend ? 'prepend' : 'append';
        $view->placeholder(self::SIDEBAR)->{$method}($content);
    }
Action_Helper_Sidebar