Webiny\Component\Bootstrap\ApplicationClasses\View::getStyleSheetsHtml PHP Метод

getStyleSheetsHtml() публичный Метод

Get the stylesheet list as html tags.
public getStyleSheetsHtml ( ) : string
Результат 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

Пример #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());
 }