Perforce Chronicle 2012.2/486814
API Documentation

P4Cms_Form_SubForm Class Reference

Extends Zend_Form_SubForm to be aware of our prefix/elementPrefix paths. More...

Inheritance diagram for P4Cms_Form_SubForm:
Category_Form_AssociatedCategoriesWidget Category_Form_Content Comment_Form_Content Content_Form_GridTypeFilter Content_Form_ListWidget Content_Form_Save Flickr_Form_StreamWidget Menu_Form_Content Menu_Form_Widget Ui_Form_GridSearch Url_Form_Content Widget_Form_IframeWidget Widget_Form_ImageWidget Widget_Form_TextWidget Workflow_Form_EditContent Workflow_Form_GridStateFilter Youtube_Form_VideoWidget

List of all members.

Public Member Functions

 __construct ($options=null)
 Extend Zend_Dojo_Form's constructor to provide our own decorators.
 getIdPrefix ()
 Get the string used to prefix element ids.
 render (Zend_View_Interface $view=null)
 Add id prefixes, then render the form.
 setIdPrefix ($prefix)
 Set a string to prefix element ids with.

Protected Attributes

 $_idPrefix

Detailed Description

Extends Zend_Form_SubForm to be aware of our prefix/elementPrefix paths.

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

Constructor & Destructor Documentation

P4Cms_Form_SubForm::__construct ( options = null)

Extend Zend_Dojo_Form's constructor to provide our own decorators.

Parameters:
array | Zend_Config | null$optionsZend provides no documentation for this param.
Returns:
void
    {
        // combine library prefix paths with paths from
        // the P4Cms_Form static registry.
        $prefixPaths = P4Cms_Form::getLibraryPathRegistry() + P4Cms_Form::getPrefixPathRegistry();

        // add prefix paths to form instance.
        foreach ($prefixPaths as $prefixPath) {
            extract($prefixPath);

            // add element and decorator paths to form.
            if ($type === static::ELEMENT || $type === static::DECORATOR) {
                $this->addPrefixPath($prefix, $path, $type);
            }

            // add decorator, validator and filter paths to elements.
            if ($type !== static::ELEMENT) {
                $this->addElementPrefixPath($prefix, $path, $type);
            }

            // add decorator paths to display groups.
            if ($type === static::DECORATOR) {
                $this->addDisplayGroupPrefixPath($prefix, $path);
            }
        }
        
        parent::__construct($options);
    }

Member Function Documentation

P4Cms_Form_SubForm::getIdPrefix ( )

Get the string used to prefix element ids.

Returns:
string the string used to prefix element ids.
    {
        return $this->_idPrefix;
    }
P4Cms_Form_SubForm::render ( Zend_View_Interface $  view = null)

Add id prefixes, then render the form.

Parameters:
Zend_View_Interface$viewThe Zend View Interface to render.
Returns:
string

Reimplemented in Workflow_Form_EditContent.

    {
        // prefix form element ids if id prefix is set.
        if ($this->getIdPrefix()) {
            P4Cms_Form::prefixFormIds($this, $this->getIdPrefix());
        }

        return parent::render($view);
    }
P4Cms_Form_SubForm::setIdPrefix ( prefix)

Set a string to prefix element ids with.

Parameters:
string$prefixthe string to prefix element ids with.
Returns:
P4Cms_Form_SubForm provides fluent interface.
    {
        $this->_idPrefix = (string) $prefix;
        return $this;
    }

Member Data Documentation

P4Cms_Form_SubForm::$_idPrefix [protected]

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