Perforce Chronicle 2012.2/486814
API Documentation

Content_Form_Decorator_DisplaySelectedContent Class Reference

A simple wrapper around the content list view helper. More...

List of all members.

Public Member Functions

 render ($content)
 Renders the value (a list of content ids) using the content list helper.

Detailed Description

A simple wrapper around the content list view helper.

For use with the content select element and content editing (allows content select elements to render a list of content when used with content).

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_Decorator_DisplaySelectedContent::render ( content)

Renders the value (a list of content ids) using the content list helper.

Any options set on the decorator will be passed through to the list helper.

Parameters:
string$contentThe content to render.
Returns:
string the result of the content list view helper.
    {
        $element = $this->getElement();
        $value   = array_filter((array) $this->getElement()->getValue());
        $view    = $element->getView();
        $helper  = $view->getHelper('contentList');
        $query   = new P4Cms_Record_Query;

        // limit result to just the selected content.
        $query->setIds($value);

        // default is to sort entries in the order they were selected.
        $options = $this->getOptions();
        $options['postSort'] = isset($options['postSort'])
            ? $options['postSort']
            : array('id' => array(P4Cms_Model_Iterator::SORT_FIXED => $value));

        return $helper->contentList($query, $options)->render();
    }

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