Back to Document class

Method addStyleDeclaration

public \Joomla\CMS\Document\Document
addStyleDeclaration
(mixed $content, mixed $type = 'text/css')
Adds a stylesheet declaration to the page
Parameters
  • string $content Style declarations
  • string $type Type of stylesheet (defaults to 'text/css')
Returns
  • \Joomla\CMS\Document\Document instance of $this to allow chaining
Since
  • 1.7.0
Deprecated
  • 5.0
Class: Document
Project: Joomla

Method addStyleDeclaration - Source code

/**
 * Adds a stylesheet declaration to the page
 *
 * @param   string  $content  Style declarations
 * @param   string  $type     Type of stylesheet (defaults to 'text/css')
 *
 * @return  Document instance of $this to allow chaining
 *
 * @since   1.7.0
 *
 * @deprecated 5.0  Use WebAssetManager
 */
public function addStyleDeclaration($content, $type = 'text/css')
{
    $type = strtolower($type);
    if (empty($this->_style[$type])) {
        $this->_style[$type] = array();
    }
    $this->_style[$type][md5($content)] = $content;
    return $this;
}