Example #1
0
 /**
  * Renders the content to be inserted in the head section.
  * The content is rendered using the registered meta tags, link tags, CSS/JS code blocks and files.
  *
  * @return string the rendered content
  */
 protected function renderHeadHtml()
 {
     $lines = [];
     $lines[] = $this->head;
     $lines[] = '<head>';
     $lines[] = Html::tag('title', $this->title);
     if (!empty($this->metaTags)) {
         $lines[] = implode("\n", $this->metaTags);
     }
     if (!empty($this->linkTags)) {
         $lines[] = implode("\n", $this->linkTags);
     }
     if (!empty($this->cssFiles[self::POS_HEAD])) {
         $lines[] = implode("\n", $this->cssFiles[self::POS_HEAD]);
     }
     if (!empty($this->css)) {
         $lines[] = implode("\n", $this->css);
     }
     if (!empty($this->jsFiles[self::POS_HEAD])) {
         $lines[] = implode("\n", $this->jsFiles[self::POS_HEAD]);
     }
     if (!empty($this->js[self::POS_HEAD])) {
         $lines[] = Html::script(implode("\n", $this->js[self::POS_HEAD]), ['type' => 'text/javascript']);
     }
     $lines[] = '</head>';
     return empty($lines) ? '' : implode("\n", $lines);
 }