|
Perforce Chronicle 2012.2/486814
API Documentation
|
A specialized version of the content select element that is pre-configured to work well for selecting and displaying images. More...
Public Member Functions | |
| getDefaultDisplayDecorators () | |
| Get the default display decorators to use when rendering content elements of this type. | |
A specialized version of the content select element that is pre-configured to work well for selecting and displaying images.
| Content_Form_Element_ImageSelect::getDefaultDisplayDecorators | ( | ) |
Get the default display decorators to use when rendering content elements of this type.
Image display options can be influenced without redeclaring the decorators via 'display.image'. For example:
gallery.display.image.height = 150 gallery.display.image.link = true gallery.display.image.target = _lightbox
Reimplemented from Content_Form_Element_ContentSelect.
{
// extract display options from content element definition
// if this form element is being used in a content type.
$options = array();
if ($this->getContentRecord()) {
$content = $this->getContentRecord();
$element = $content->getContentType()->getElement($this->getName());
$options = isset($element['display']['image'])
? (array) $element['display']['image']
: $options;
}
return array(
array(
'decorator' => 'DisplaySelectedContent',
'options' => array(
'emptyMessage' => '',
'fields' => array(
'file' => array(
'decorators' => array(
array(
'decorator' => 'DisplayImage',
'options' => $options
)
)
)
)
)
)
);
}