Perforce Chronicle 2012.2/486814
API Documentation

P4Cms_View_Helper_HeadStyle Class Reference

Extends the head style helper to add media queries support. More...

List of all members.

Public Member Functions

 itemToString (stdClass $item, $indent)
 Convert content and attributes into valid style tag.

Detailed Description

Extends the head style helper to add media queries support.

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_View_Helper_HeadStyle::itemToString ( stdClass $  item,
indent 
)

Convert content and attributes into valid style tag.

We add the item's media value to _mediaTypes and then call the parent method. This way, the media type validation in the parent is ignored.

Parameters:
stdClass$itemItem to render
string$indentIndentation to use
Returns:
string
    {
        $value = isset($item->attributes['media']) ? $item->attributes['media'] : '';
        if (false === strpos($value, ',')) {
            $this->_mediaTypes[] = $value;
        } else {
            foreach (explode(',', $value) as $type) {
                $this->_mediaTypes[] = trim($type);
            }
        }
        
        return parent::itemToString($item, $indent);
    }

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