Microweber\Providers\Template::head PHP Метод

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

public head ( $script_src )
    public function head($script_src)
    {
        if ($this->head_callable == null) {
            $this->head_callable = array();
        }
        if (is_string($script_src)) {
            if (!in_array($script_src, $this->head)) {
                $this->head[] = $script_src;
                return $this->head;
            }
        } else {
            if (is_bool($script_src)) {
                //   return $this->head;
                $src = '';
                if (is_array($this->head)) {
                    foreach ($this->head as $header) {
                        $ext = get_file_extension($header);
                        switch (strtolower($ext)) {
                            case 'css':
                                $src .= '<link rel="stylesheet" href="' . $header . '" type="text/css" media="all">' . "\n";
                                break;
                            case 'js':
                                $src .= '<script type="text/javascript" src="' . $header . '"></script>' . "\n";
                                break;
                            default:
                                $src .= $header . "\n";
                                break;
                        }
                    }
                }
                return $src;
            } elseif (is_callable($script_src)) {
                if (!in_array($script_src, $this->head_callable)) {
                    $this->head_callable[] = $script_src;
                    return $this->head_callable;
                }
            }
        }
    }