Perforce Chronicle 2012.2/486814
API Documentation

Content_Form_Element_ImageSelect Class Reference

A specialized version of the content select element that is pre-configured to work well for selecting and displaying images. More...

Inheritance diagram for Content_Form_Element_ImageSelect:
Content_Form_Element_ContentSelect P4Cms_Content_EnhancedElementInterface P4Cms_Content_EnhancedElementInterface

List of all members.

Public Member Functions

 getDefaultDisplayDecorators ()
 Get the default display decorators to use when rendering content elements of this type.

Detailed Description

A specialized version of the content select element that is pre-configured to work well for selecting and displaying images.

Copyright:
2011-2012 Perforce Software. All rights reserved
License:
Please see LICENSE.txt in top-level folder of this distribution.
Version:
2012.2/486814

Member Function Documentation

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

Returns:
array decorators configuration array suitable for passing to element setDecorators().

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
                                )
                            )
                        )
                    )
                )
            )
        );
    }

The documentation for this class was generated from the following file: