search('applicationDirectory'); $layoutDirectory = $applicationDirectory->search('layoutsDirectory'); if ($layoutDirectory == false) { $layoutDirectory = $applicationDirectory->createResource('layoutsDirectory'); } $layoutScriptsDirectory = $layoutDirectory->search('layoutScriptsDirectory'); if ($layoutScriptsDirectory == false) { $layoutScriptsDirectory = $layoutDirectory->createResource('layoutScriptsDirectory'); } $layoutScriptFile = $layoutScriptsDirectory->search('layoutScriptFile', array('layoutName' => 'layout')); if ($layoutScriptFile == false) { $layoutScriptFile = $layoutScriptsDirectory->createResource('layoutScriptFile', array('layoutName' => 'layout')); } return $layoutScriptFile; } public function enable() { $profile = $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); $applicationConfigResource = $profile->search('ApplicationConfigFile'); if (!$applicationConfigResource) { throw new Zend_Tool_Project_Exception('A project with an application config file is required to use this provider.'); } $zc = $applicationConfigResource->getAsZendConfig(); if (isset($zc->resources) && isset($zf->resources->layout)) { $this->_registry->getResponse()->appendContent('A layout resource already exists in this project\'s application configuration file.'); return; } $layoutPath = 'APPLICATION_PATH "/layouts/scripts/"'; if ($this->_registry->getRequest()->isPretend()) { $this->_registry->getResponse()->appendContent('Would add "resources.layout.layoutPath" key to the application config file.'); } else { $applicationConfigResource->addStringItem('resources.layout.layoutPath', $layoutPath, 'production', false); $applicationConfigResource->create(); $layoutScriptFile = self::createResource($profile); $layoutScriptFile->create(); $this->_registry->getResponse()->appendContent( 'Layouts have been enabled, and a default layout created at ' . $layoutScriptFile->getPath() ); $this->_registry->getResponse()->appendContent('A layout entry has been added to the application config file.'); } } public function disable() { // @todo } }