Perforce Chronicle 2012.2/486814
API Documentation
|
Enhances Zend_Controller_Action to provide additional functionality that is specific to widget controllers. More...
Public Member Functions | |
getOption ($option, $default=null) | |
Get a saved option for this widget instance. | |
getOptions () | |
Get all saved options for this widget instance. | |
init () | |
Prepare the widget view with context data. | |
Static Public Member Functions | |
static | getConfigSubForm ($widget, $request) |
Get config sub-form to present additional options when configuring a widget of this type. | |
static | saveConfigForm ($form, $widget) |
Updates the widget model with the passed configuration form values and writes out the new settings to storage. | |
Protected Member Functions | |
_getWidget () | |
Get the widget model associated with this widget controller instance. |
Enhances Zend_Controller_Action to provide additional functionality that is specific to widget controllers.
P4Cms_Widget_ControllerAbstract::_getWidget | ( | ) | [protected] |
Get the widget model associated with this widget controller instance.
{ // the associated widget model is passed in via // the request parameters - it could be a widget // model instance, or string id in the latter case $request = $this->getRequest(); $widget = $request->getParam('widget'); if (!$widget instanceof P4Cms_Widget) { $widget = P4Cms_Widget::fetch($widget); } return $widget; }
static P4Cms_Widget_ControllerAbstract::getConfigSubForm | ( | $ | widget, |
$ | request | ||
) | [static] |
Get config sub-form to present additional options when configuring a widget of this type.
The config form will then be integrated into the default widget config form to present additional options to the user when configuring the widget. The saved form values be passed as additional request parameters to actions on the widget controller.
P4Cms_Widget | $widget | the widget instance being configured. |
Zend_Controller_Request_Abstract | $request | the request values. |
Reimplemented in Menu_WidgetController.
{
return null;
}
P4Cms_Widget_ControllerAbstract::getOption | ( | $ | option, |
$ | default = null |
||
) |
Get a saved option for this widget instance.
string | $option | the name of the option to get. |
mixed | $default | optional - a default value to return if no value is set. |
{ return $this->_getWidget()->getConfig($option, $default); }
P4Cms_Widget_ControllerAbstract::getOptions | ( | ) |
Get all saved options for this widget instance.
{ return $this->_getWidget()->getConfig(); }
P4Cms_Widget_ControllerAbstract::init | ( | ) |
Prepare the widget view with context data.
{ parent::init(); // handle any provided widgetContext $this->widgetContext->setEncodedValues( $this->getRequest()->getParam('widgetContext') ); // make the widget context available to the view $this->view->widgetContext = $this->widgetContext->getEncodedValues(); }
static P4Cms_Widget_ControllerAbstract::saveConfigForm | ( | $ | form, |
$ | widget | ||
) | [static] |
Updates the widget model with the passed configuration form values and writes out the new settings to storage.
Zend_Form | $form | form with new config values |
P4Cms_Widget | $widget | widget to save |
{ $widget->setValues($form->getValues())->save(); // clear any cached entries related to this widget P4Cms_Cache::clean( Zend_Cache::CLEANING_MODE_MATCHING_TAG, 'p4cms_widget_' . bin2hex($widget->getId()) ); }