Issues

ZF-7062: Zend_Application_Resource_Layout: support for custom Layout Classes (My_Layout)

Description

Hi,

it would be nice to get support for custom Layout classes like My_Layout by the layout resource plugin.

currently I workaround this by using the _init() functions in Bootstrap to get the layout initialized:

protected function _initLayout () { $view = $this->getResource('View');

    $options = array(
        'view'     => $view,
        'layout'     => 'layout_standard',
        'layoutPath' => APPLICATION_PATH . '/layouts/scripts/',
        'contentKey' => 'content',           // ignored when MVC not used
        'viewSuffix' => 'html',
    );

    Herod_Layout::startMvc($options);
    $layout = Herod_Layout::getMvcInstance();
    return $layout;
} 

thx and greetings! marco

Comments

That not an bug, create your own Resource Plugin!

/library/App/Application/Resource/Layout.php


class App_Application_Resource_Layout extends Zend_Application_Resource_Layout {
    public function getLayout()
    {
        if (null === $this->_layout) {
            $this->_layout = Herod_Layout::startMvc($this->getOptions());
        }
        return $this->_layout;
    }
} 

and for the applications.ini: /application/configs/application.ini


resources.App_Application_Resource_Layout.yourOptions

This is not an issue. The resource plugins that are shipped with ZF are meant for ZF components only. If you need a resource plugin for another component you can simply extend Zend_Application_Resource_Layout or Zend_Application_Resource_ResourceAbstract.