|
Perforce Chronicle 2012.2/486814
API Documentation
|
A widget that displays arbitrary text in a region. More...
Public Member Functions | |
| indexAction () | |
| Display the text stored in the widget. | |
Static Public Member Functions | |
| static | getConfigSubForm ($widget) |
| Get config sub-form to present additional options when configuring a widget of this type. | |
A widget that displays arbitrary text in a region.
The text can be edited.
| static Widget_TextWidgetController::getConfigSubForm | ( | $ | widget | ) | [static] |
Get config sub-form to present additional options when configuring a widget of this type.
| P4Cms_Widget | $widget | the widget instance being configured. |
{
// if we are configured to solidify macros expand macros the first
// time the widget is configured and clear the solidify flag.
if ($widget->getConfig('solidifyMacros')) {
$filter = new P4Cms_Filter_Macro(array('widget' => $widget));
$text = $filter->filter($widget->getConfig('text'));
$widget->getConfig()->text = $text;
$widget->getConfig()->solidifyMacros = false;
}
// de-branchify urls so that they do not get edited
// or stored with a branch specific base url.
$filter = new P4Cms_Filter_DebranchifyUrls;
$text = $filter->filter($widget->getConfig('text'));
$widget->getConfig()->text = $text;
return new Widget_Form_TextWidget;
}
| Widget_TextWidgetController::indexAction | ( | ) |
Display the text stored in the widget.
{
// disable autorendering for this action.
$this->_helper->viewRenderer->setNoRender();
// apply macro expansion so users can embed macros
// branchify urls so they point to the active branch
$text = $this->getOption('text');
$macro = new P4Cms_Filter_Macro(array('widget' => $this->_getWidget()));
$branchify = new P4Cms_Filter_BranchifyUrls;
print $branchify->filter($macro->filter($text));
}