Perforce Chronicle 2012.2/486814
API Documentation
|
This decorator extends the htmltag decorator and implements the enhanced decorator interface to add the icon from a content type when decorating content. More...
Public Member Functions | |
getContentRecord () | |
Get the associated content record (if set). | |
render ($content) | |
Gets the uri of the icon from the content type of the entry then renders using the parent method by setting applicable options. | |
setContentRecord ($content) | |
Set the associated content record for this element. | |
Protected Attributes | |
$_contentRecord = null | |
$_cssClass = 'content-type-icon' | |
$_tag = 'img' |
This decorator extends the htmltag decorator and implements the enhanced decorator interface to add the icon from a content type when decorating content.
It introduces the content-type-icon-small css class, used to style smaller content type icons in a consistent manner.
Content_Form_Decorator_ContentIcon::getContentRecord | ( | ) |
Get the associated content record (if set).
Implements P4Cms_Content_EnhancedDecoratorInterface.
{
return $this->_contentRecord;
}
Content_Form_Decorator_ContentIcon::render | ( | $ | content | ) |
Gets the uri of the icon from the content type of the entry then renders using the parent method by setting applicable options.
If no entry is provided, does not perform render.
string | $content | The content to decorate. |
{ if (!$this->getContentRecord()) { return $content; } $type = $this->getContentRecord()->getContentType(); $view = $this->getElement()->getView(); $iconUrl = $view->url( array ( 'module' => 'content', 'controller' => 'type', 'action' => 'icon', 'id' => $type->getId() ) ); $this->setOption('class', $this->_cssClass); $this->setOption('src', $iconUrl); return parent::render($content); }
Content_Form_Decorator_ContentIcon::setContentRecord | ( | $ | content | ) |
Set the associated content record for this element.
P4Cms_Content | $content | the associated content record for this element. |
Implements P4Cms_Content_EnhancedDecoratorInterface.
{
$this->_contentRecord = $content;
return $this;
}
Content_Form_Decorator_ContentIcon::$_contentRecord = null [protected] |
Content_Form_Decorator_ContentIcon::$_cssClass = 'content-type-icon' [protected] |
Content_Form_Decorator_ContentIcon::$_tag = 'img' [protected] |