Webiny\Component\Bootstrap\ApplicationClasses\View::getStyleSheetsHtml PHP Méthode

getStyleSheetsHtml() public méthode

Get the stylesheet list as html tags.
public getStyleSheetsHtml ( ) : string
Résultat string
    public function getStyleSheetsHtml()
    {
        $styleSheets = '';
        if (!isset($this->styles)) {
            return $styleSheets;
        }
        foreach ($this->styles as $s) {
            $styleSheets .= '<link rel="stylesheet" type="text/css" href="' . $s . '"/>' . "\n";
        }
        return $styleSheets;
    }

Usage Example

Exemple #1
0
 public function testStyleSheets()
 {
     $view = new View();
     $styleOne = 'styleOne.js';
     $styleTwo = 'styleTwo.js';
     $styleThree = 'styleThree.js';
     $view->appendStyleSheet($styleOne);
     $view->prependStyleSheet($styleTwo);
     $view->appendStyleSheet($styleThree);
     $stylesArray = $view->getStyleSheets();
     $expectedArray = [$styleTwo, $styleOne, $styleThree];
     $this->assertSame($expectedArray, $stylesArray);
     $html = '';
     foreach ($expectedArray as $s) {
         $html .= '<link rel="stylesheet" type="text/css" href="' . $s . '"/>' . "\n";
     }
     $this->assertSame($html, $view->getStyleSheetsHtml());
 }