Perforce Chronicle 2012.2/486814
API Documentation

P4Cms_Form_Element_TooltipDialogButton Class Reference

A drop-down button with a tooltip dialog. More...

Inheritance diagram for P4Cms_Form_Element_TooltipDialogButton:
P4Cms_Form_Element_ConfirmTooltipButton

List of all members.

Public Member Functions

 getValue ()
 Get the rendered tooltip dialog.
 loadDefaultDecorators ()
 Default decorators.
 setContent ($content)
 Set the content to put in the tooltip dialog.
 setHref ($href)
 Set the href to use for the tooltip dialog.
 setLabel ($label)
 Set the label to display in the button.

Public Attributes

 $dijitParams
 $helper = 'CustomDijit'

Protected Member Functions

 _getTooltipAttribs ()
 Get the attributes to set on the tooltip element.

Protected Attributes

 $_content = null
 $_dialogDojoType = 'p4cms.ui.TooltipDialog'
 $_href = null

Detailed Description

A drop-down button with a tooltip dialog.

To populate the tooltip dialog, set the href or content properties of the element.

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

P4Cms_Form_Element_TooltipDialogButton::_getTooltipAttribs ( ) [protected]

Get the attributes to set on the tooltip element.

Returns:
array key/value attributes for the dijit element.
    {
        return array_merge(
            $this->getAttribs(),
            array(
                'dojoType'  => $this->_dialogDojoType,
                'href'      => $this->_href
            )
        );
    }
P4Cms_Form_Element_TooltipDialogButton::getValue ( )

Get the rendered tooltip dialog.

The custom dijit helper uses the value of the element to populate the content of the dijit - that is why we use getValue() to provide the rendered dialog.

Returns:
string the rendered tooltip dialog.
    {
        $view = $this->getView();

        return $view->customDijit(
            $this->getId() . '-tooltip-dialog',
            $this->_content,
            $this->_getTooltipAttribs()
        );
    }
P4Cms_Form_Element_TooltipDialogButton::loadDefaultDecorators ( )

Default decorators.

Uses only 'DijitElement' and 'DtDdWrapper' decorators by default.

Returns:
void
    {
        if ($this->loadDefaultDecoratorsIsDisabled()) {
            return;
        }

        $decorators = $this->getDecorators();
        if (empty($decorators)) {
            $this->addDecorator('DijitElement')
                 ->addDecorator('DtDdWrapper');
        }
    }
P4Cms_Form_Element_TooltipDialogButton::setContent ( content)

Set the content to put in the tooltip dialog.

Parameters:
string$contentthe content to put in the tooltip dialog.
    {
        $this->_content = (string) $content;

        return $this;
    }
P4Cms_Form_Element_TooltipDialogButton::setHref ( href)

Set the href to use for the tooltip dialog.

Parameters:
string$hrefthe href to pass set on the tooltip dialog.
Returns:
P4Cms_Form_Element_TooltipDialogButton provides fluent interface.
    {
        $this->_href = (string) $href;

        return $this;
    }
P4Cms_Form_Element_TooltipDialogButton::setLabel ( label)

Set the label to display in the button.

We implement this method to copy the label to dijit params.

Parameters:
string$labelthe label to display in the button.
Returns:
P4Cms_Form_Element_TooltipDialogButton provides fluent interface.
    {
        $this->dijitParams['label'] = $label;
        parent::setLabel($label);

        return $this;
    }

Member Data Documentation

P4Cms_Form_Element_TooltipDialogButton::$_content = null [protected]
P4Cms_Form_Element_TooltipDialogButton::$_dialogDojoType = 'p4cms.ui.TooltipDialog' [protected]
P4Cms_Form_Element_TooltipDialogButton::$_href = null [protected]
P4Cms_Form_Element_TooltipDialogButton::$dijitParams
Initial value:
 array(
        'dojoType' => 'dijit.form.DropDownButton',
    )
P4Cms_Form_Element_TooltipDialogButton::$helper = 'CustomDijit'

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