Perforce Chronicle 2012.2/486814
API Documentation
|
Handles configuration of the flickr module. More...
Public Member Functions | |
indexAction () | |
Show form, persist into module config (fetch module, set config) |
Handles configuration of the flickr module.
Flickr_ConfigureController::indexAction | ( | ) |
Show form, persist into module config (fetch module, set config)
{ $module = P4Cms_Module::fetch('Flickr'); $form = new Flickr_Form_Configure(); $this->view->form = $form; // if request, save; if error, show; if not, show form $request = $this->getRequest(); if ($request->isPost()) { $unvalidatedValues = $request->getPost(); if ($form->isValid($unvalidatedValues)) { $values = $form->getValues(); // save configuration $module->saveConfig( new Zend_Config( array( 'key' => $values['key'] ) ) ); // store stuff, redirect P4Cms_Notifications::add('Flickr API configuration stored.'); $this->redirector->gotoSimple('index', 'module', 'site'); } else { P4Cms_Notifications::add( 'Invalid value entered for Flickr module configuration.', 'error' ); $form->populate($unvalidatedValues); } } else { $config = $module->getConfig(); $values = $config->toArray(); $form->populate( array( 'key' => isset($values['key']) ? $values['key'] : '' ) ); } }