FOF30\Template\Template::addCSS PHP Method

addCSS() public method

Add a CSS file to the page generated by the CMS
See also: self::parsePath
public addCSS ( string $uri, string $version = null, string $type = 'text/css', string $media = null, array $attribs = [] ) : void
$uri string A path definition understood by parsePath, e.g. media://com_example/css/foo.css
$version string (optional) Version string to be added to the URL
$type string MIME type of the stylesheeet
$media string Media target definition of the style sheet, e.g. "screen"
$attribs array Array of attributes
return void
    public function addCSS($uri, $version = null, $type = 'text/css', $media = null, $attribs = array())
    {
        if ($this->container->platform->isCli()) {
            return;
        }
        $method = 'addStyleSheet' . (!empty($version) ? 'Version' : '');
        $document = $this->container->platform->getDocument();
        if (!method_exists($document, $method)) {
            return;
        }
        $url = $this->container->template->parsePath($uri);
        if (empty($version)) {
            $document->addStyleSheet($url, $type, $media, $attribs);
            return;
        }
        $document->addStyleSheetVersion($url, $version, $type, $media, $attribs);
    }