Documentation

Head
in package

FinalYes

Head class

This class is responsible for managing the HTML head section of a web page.

It provides methods to set the title, add CSS and JavaScript files, add meta tags, add link tags, add property tags, add generator tags and set other head section attributes.

Tags
final

Table of Contents

Constants

VERSION  : mixed = '1.0'

Properties

$apple  : array<string|int, mixed>
$author  : string
$authoringTool  : string
$charset  : string
$colorScheme  : string
$copyright  : string
$creationdate  : string
$css  : array<string|int, mixed>
$description  : string
$distribution  : string
$generator  : array<string|int, mixed>
$js  : array<string|int, mixed>
$keywords  : string
$link  : array<string|int, mixed>
$meta  : array<string|int, mixed>
$ms  : array<string|int, mixed>
$property  : array<string|int, mixed>
$rating  : string
$revisitAfter  : string
$robots  : string
$themeColor  : string
$title  : string
$viewport  : string

Methods

__debugInfo()  : array<string|int, mixed>
Return an array containing the debug information of the current Head object.
__invoke()  : string
This magic method is used to convert the Head object to a string.
__toString()  : string
This magic method is used to convert the Head object to a string.
alAndroidAppName()  : Head
Sets the Android app name meta tag.
alAndroidClass()  : Head
Sets the Android class meta tag.
alAndroidPackage()  : Head
Sets the Android package meta tag.
alAndroidUrl()  : Head
Sets the Android URL meta tag.
alternate()  : Head
Sets an alternate link node.
appleaAdressDetection()  : Head
Adds an Apple address format detection meta tag to the head.
appleaDateDetection()  : Head
Adds an Apple date format detection meta tag to the head.
appleEmailDetection()  : Head
Adds an Apple email format detection meta tag to the head.
appleFormatDetection()  : Head
Adds an Apple format detection meta tag to the head.
appleItunesApp()  : Head
Adds an Apple iTunes app meta tag to the head.
appleMaskIcon()  : Head
Adds an Apple mask icon meta tag to the head.
appleMobileWebAppCapable()  : Head
Adds an Apple mobile web app capable meta tag to the head.
appleMobileWebAppStatusBarStyle()  : Head
Adds an Apple mobile web app status bar style meta tag to the head.
appleMobileWebAppTitle()  : Head
Adds an Apple mobile web app title meta tag to the head.
appleTelephoneDetection()  : Head
Adds an Apple telephone format detection meta tag to the head.
appleTouchIcon()  : Head
Adds an Apple touch icon meta tag to the head.
appleTouchStartupImage()  : Head
Adds an Apple touch startup image meta tag to the head.
author()  : Head
Adds an author node to the head.
authoringTool()  : Head
Adds an authoring tool node to the head.
base()  : Head
Adds a base node with a reference to an external URL to the head.
build()  : string
Builds the HTML head section based on the current Head object.
canonical()  : Head
Adds a canonical node to the head.
charset()  : Head
Adds a charset node to the head.
colorScheme()  : Head
Adds a color scheme node to the head.
copyright()  : Head
Adds a copyright node to the head.
creationdate()  : Head
Adds a creation date node to the head.
description()  : Head
Adds a description node to the head.
distribution()  : Head
Adds a distribution node to the head.
favicon()  : Head
Adds a favicon node to the head.
generator()  : Head
Adds a generator node to the head.
icon()  : Head
Adds an icon node to the head.
keywords()  : Head
Adds a keywords node to the head.
link()  : Head
Adds a link node to the head.
manifest()  : Head
Adds a manifest node to the head.
meta()  : Head
Meta method
msApplicationID()  : Head
Sets the Microsoft application ID meta tag.
msApplicationName()  : Head
Sets the Microsoft application name meta tag.
msApplicationPackageFamilyName()  : Head
Sets the Microsoft application package family name meta tag.
msApplicationStarturl()  : Head
Sets the Microsoft application start URL meta tag.
msApplicationTooltip()  : Head
Sets the Microsoft application tooltip meta tag.
og()  : Head
Adds an OpenGraph meta tag to the head.
ogDescription()  : Head
Adds an OpenGraph meta tag to the head.
ogDeterminer()  : Head
Adds an OpenGraph Determiner meta tag to the head.
ogImage()  : Head
Adds an OpenGraph image meta tag to the head.
ogImageHeight()  : Head
Adds an OpenGraph image height meta tag to the head.
ogImageWidth()  : Head
Adds an OpenGraph image width meta tag to the head.
ogLocale()  : Head
Adds an OpenGraph locale meta tag to the head.
ogSiteName()  : Head
Adds an OpenGraph site name meta tag to the head.
ogTitle()  : Head
Adds an OpenGraph meta tag to the head.
ogType()  : Head
Adds an OpenGraph type meta tag to the head.
ogUrl()  : Head
Adds an OpenGraph URL meta tag to the head.
property()  : Head
Sets a property node.
rating()  : Head
Adds a rating node to the head.
revisitAfter()  : Head
Adds a revisit-after node to the head.
robots()  : Head
Adds a robots node to the head.
script()  : Head
Adds a script node to the head.
scriptText()  : Head
Adds a script node with text content to the head.
shortcutIcon()  : Head
Adds a shortcut icon node to the head.
stylesheet()  : Head
Adds a stylesheet node with a reference to an external CSS file to the head.
stylesheetText()  : Head
Adds a stylesheet node with inline CSS code to the head.
themeColor()  : Head
Adds a theme color node to the head.
title()  : Head
Adds a title node with the title of the HTML document to the head.
viewport()  : Head
Adds a viewport node to the head.
addNode()  : string
Add a node to the head.
metaReturn()  : string
Meta return method

Constants

VERSION

public mixed VERSION = '1.0'

Properties

$apple

private array<string|int, mixed> $apple = []

$author

private string $author = ''

$authoringTool

private string $authoringTool = ''

$charset

private string $charset = ''

$colorScheme

private string $colorScheme = ''
private string $copyright = ''

$creationdate

private string $creationdate = ''

$css

private array<string|int, mixed> $css = []

$description

private string $description = ''

$distribution

private string $distribution = ''

$generator

private array<string|int, mixed> $generator = []

$js

private array<string|int, mixed> $js = []

$keywords

private string $keywords = ''
private array<string|int, mixed> $link = []

$meta

private array<string|int, mixed> $meta = []

$ms

private array<string|int, mixed> $ms = []

$property

private array<string|int, mixed> $property = []

$rating

private string $rating = ''

$revisitAfter

private string $revisitAfter = ''

$robots

private string $robots = ''

$themeColor

private string $themeColor = ''

$title

private string $title = ''

$viewport

private string $viewport = ''

Methods

__debugInfo()

Return an array containing the debug information of the current Head object.

public __debugInfo() : array<string|int, mixed>

This method is used by the var_dump() function to display the debug information of the current Head object.

Return values
array<string|int, mixed>

The debug information of the current Head object.

__invoke()

This magic method is used to convert the Head object to a string.

public __invoke() : string

When the Head object is converted to a string, this method will be called. It will return the HTML head tag with all the meta tags and other information.

Return values
string

The HTML head tag with all the meta tags and other information.

__toString()

This magic method is used to convert the Head object to a string.

public __toString() : string

When the Head object is converted to a string, this method will be called. It will return the HTML head tag with all the meta tags and other information.

Return values
string

The HTML head tag with all the meta tags and other information.

alAndroidAppName()

Sets the Android app name meta tag.

public alAndroidAppName(string $content) : Head

The Android app name meta tag is used by Google Play to determine which app to open when a user clicks on an Android App Link.

Parameters
$content : string

The value of the Android app name meta tag.

Return values
Head

The current Head object.

alAndroidClass()

Sets the Android class meta tag.

public alAndroidClass(string $content) : Head

The Android class meta tag is used to specify the class of the app that is associated with the URL.

Parameters
$content : string

The value of the Android class meta tag.

Return values
Head

The current Head object.

alAndroidPackage()

Sets the Android package meta tag.

public alAndroidPackage(string $content) : Head

The Android package meta tag is used by Google Play to determine which app to open when a user clicks on an Android App Link.

Parameters
$content : string

The value of the Android package meta tag.

Return values
Head

The current Head object.

alAndroidUrl()

Sets the Android URL meta tag.

public alAndroidUrl(string $content) : Head

The Android URL meta tag is used to define the URL that the app is associated with.

Parameters
$content : string

The value of the Android URL meta tag.

Return values
Head

The current Head object.

alternate()

Sets an alternate link node.

public alternate(string $content) : Head

An alternate link node is a type of link node that is used to define an alternative representation of the HTML document. It is commonly used to define a canonical URL for the HTML document.

Parameters
$content : string

The content of the alternate link node.

Return values
Head

The current Head object.

appleaAdressDetection()

Adds an Apple address format detection meta tag to the head.

public appleaAdressDetection([bool $content = true ]) : Head

The Apple address format detection meta tag is used to define whether the HTML document is able to detect addresses in the document and convert them to clickable links or not.

Parameters
$content : bool = true

If true, the HTML document is able to detect addresses. If false, it is not.

Return values
Head

The current Head object.

appleaDateDetection()

Adds an Apple date format detection meta tag to the head.

public appleaDateDetection([bool $content = true ]) : Head

The Apple date format detection meta tag is used to define whether the HTML document is able to detect dates in the document and convert them to clickable links or not.

Parameters
$content : bool = true

If true, the HTML document is able to detect dates. If false, it is not.

Return values
Head

The current Head object.

appleEmailDetection()

Adds an Apple email format detection meta tag to the head.

public appleEmailDetection([bool $content = true ]) : Head

The Apple email format detection meta tag is used to define whether the HTML document is able to detect email addresses in the document and convert them to clickable links or not.

Parameters
$content : bool = true

If true, the HTML document is able to detect email addresses. If false, it is not.

Return values
Head

The current Head object.

appleFormatDetection()

Adds an Apple format detection meta tag to the head.

public appleFormatDetection([bool $isTelephone = true ][, bool $isEmail = true ][, bool $isAddress = true ][, bool $isDate = true ]) : Head

The Apple format detection meta tag is used to define whether the HTML document is able to detect phone numbers, email addresses, addresses and dates in the document and convert them to clickable links or not.

Parameters
$isTelephone : bool = true

If true, the HTML document is able to detect phone numbers. If false, it is not.

$isEmail : bool = true

If true, the HTML document is able to detect email addresses. If false, it is not.

$isAddress : bool = true

If true, the HTML document is able to detect addresses. If false, it is not.

$isDate : bool = true

If true, the HTML document is able to detect dates. If false, it is not.

Return values
Head

The current Head object.

appleItunesApp()

Adds an Apple iTunes app meta tag to the head.

public appleItunesApp(string $content) : Head

The Apple iTunes app meta tag is used to define the ID of the iTunes app that is associated with the HTML document.

Parameters
$content : string

The ID of the iTunes app.

Return values
Head

The current Head object.

appleMaskIcon()

Adds an Apple mask icon meta tag to the head.

public appleMaskIcon(string $content, string $color) : Head

The Apple mask icon meta tag is used to define the icon that is displayed on an Apple device when the HTML document is saved to the home screen.

Parameters
$content : string

The URL of the icon.

$color : string

The color of the icon.

Return values
Head

The current Head object.

appleMobileWebAppCapable()

Adds an Apple mobile web app capable meta tag to the head.

public appleMobileWebAppCapable([bool $content = true ]) : Head

The Apple mobile web app capable meta tag is used to define whether the HTML document is an Apple mobile web app or not.

Parameters
$content : bool = true

If true, the HTML document is an Apple mobile web app. If false, it is not.

Return values
Head

The current Head object.

appleMobileWebAppStatusBarStyle()

Adds an Apple mobile web app status bar style meta tag to the head.

public appleMobileWebAppStatusBarStyle(string $content) : Head

The Apple mobile web app status bar style meta tag is used to define the style of the status bar when the HTML document is displayed on an Apple device.

Parameters
$content : string

The style of the status bar (e.g. "default", "black", "black-translucent").

Return values
Head

The current Head object.

appleMobileWebAppTitle()

Adds an Apple mobile web app title meta tag to the head.

public appleMobileWebAppTitle(string $content) : Head

The Apple mobile web app title meta tag is used to define the title of the HTML document when it is displayed on an Apple device.

Parameters
$content : string

The title of the document when it is displayed on an Apple device.

Return values
Head

The current Head object.

appleTelephoneDetection()

Adds an Apple telephone format detection meta tag to the head.

public appleTelephoneDetection([bool $content = true ]) : Head

The Apple telephone format detection meta tag is used to define whether the HTML document is able to detect phone numbers in the document and convert them to clickable links or not.

Parameters
$content : bool = true

If true, the HTML document is able to detect phone numbers. If false, it is not.

Return values
Head

The current Head object.

appleTouchIcon()

Adds an Apple touch icon meta tag to the head.

public appleTouchIcon(string $content) : Head

The Apple touch icon meta tag is used to define the icon that is displayed on an Apple device when the HTML document is saved to the home screen.

Parameters
$content : string

The URL of the icon.

Return values
Head

The current Head object.

appleTouchStartupImage()

Adds an Apple touch startup image meta tag to the head.

public appleTouchStartupImage(string $content) : Head

The Apple touch startup image meta tag is used to define the image that is displayed on an Apple device when the HTML document is saved to the home screen.

Parameters
$content : string

The URL of the image.

Return values
Head

The current Head object.

author()

Adds an author node to the head.

public author(string $content) : Head

An author node is used to define the author of the HTML document.

Parameters
$content : string

The author of the HTML document.

Return values
Head

The current Head object.

authoringTool()

Adds an authoring tool node to the head.

public authoringTool(string $content) : Head

An authoring tool node is used to define the tool that was used to create the HTML document.

Parameters
$content : string

The authoring tool used to create the HTML document.

Return values
Head

The current Head object.

base()

Adds a base node with a reference to an external URL to the head.

public base(string $content) : Head

A base node with a reference to an external URL is used to define the base URL of the HTML document.

Parameters
$content : string

The URL of the external URL.

Return values
Head

The current Head object.

build()

Builds the HTML head section based on the current Head object.

public build() : string

This method will return a string containing the HTML head section based on the current Head object.

Return values
string

The HTML head section based on the current Head object.

canonical()

Adds a canonical node to the head.

public canonical(string $content) : Head

A canonical node is used to define a canonical URL for the HTML document.

Parameters
$content : string

The canonical URL of the HTML document.

Return values
Head

The current Head object.

charset()

Adds a charset node to the head.

public charset([string $content = "UTF-8" ]) : Head

A charset node is used to define the character encoding of the HTML document.

Parameters
$content : string = "UTF-8"

The character encoding of the HTML document. Default to "UTF-8".

Return values
Head

The current Head object.

colorScheme()

Adds a color scheme node to the head.

public colorScheme(ColorScheme $content) : Head

A color scheme node is used to define the preferred color scheme of the HTML document.

Parameters
$content : ColorScheme

The preferred color scheme of the HTML document.

Return values
Head

The current Head object.

Adds a copyright node to the head.

public copyright(string $content) : Head

A copyright node is used to define the copyright of the HTML document.

Parameters
$content : string

The copyright of the HTML document.

Return values
Head

The current Head object.

creationdate()

Adds a creation date node to the head.

public creationdate(string $content) : Head

A creation date node is used to define the date of creation of the HTML document.

Parameters
$content : string

The date of creation of the HTML document.

Return values
Head

The current Head object.

description()

Adds a description node to the head.

public description(string $content) : Head

A description node is used to define a short description of the HTML document.

Parameters
$content : string

The description of the HTML document.

Return values
Head

The current Head object.

distribution()

Adds a distribution node to the head.

public distribution(string $content) : Head

A distribution node is used to define the distribution of the HTML document.

Parameters
$content : string

The distribution of the HTML document.

Return values
Head

The current Head object.

favicon()

Adds a favicon node to the head.

public favicon(string $content) : Head

A favicon node is used to define a favicon for the HTML document.

Parameters
$content : string

The favicon of the HTML document.

Return values
Head

The current Head object.

generator()

Adds a generator node to the head.

public generator(string $content) : Head

A generator node is used to define the name of the software that generated the HTML document.

Parameters
$content : string

The name of the software that generated the HTML document.

Return values
Head

The current Head object.

icon()

Adds an icon node to the head.

public icon(string $content) : Head

An icon node is used to define an icon for the HTML document.

Parameters
$content : string

The icon of the HTML document.

Return values
Head

The current Head object.

keywords()

Adds a keywords node to the head.

public keywords(string $content) : Head

A keywords node is used to define the keywords of the HTML document.

Parameters
$content : string

The keywords of the HTML document.

Return values
Head

The current Head object.

Adds a link node to the head.

public link(string $name, string $content, string|null $contentType) : Head

A link node is used to define a resource that is used by the HTML document. It is commonly used to define stylesheets, scripts, and favicons.

Parameters
$name : string

The name of the link node.

$content : string

The content of the link node.

$contentType : string|null

The type of content the link node is referencing.

Return values
Head

The current Head object.

manifest()

Adds a manifest node to the head.

public manifest(string $content) : Head

A manifest node is used to define a web app manifest for the HTML document. The web app manifest is a JSON file that contains information about the web application, such as its name, description, icons, and start URL.

Parameters
$content : string

The content of the manifest node.

Return values
Head

The current Head object.

meta()

Meta method

public meta(string $name, string $content) : Head

This method sets a meta node with the given name and content.

Parameters
$name : string

The name of the meta node.

$content : string

The content of the meta node.

Return values
Head

The current Head object.

msApplicationID()

Sets the Microsoft application ID meta tag.

public msApplicationID(string $content) : Head

The Microsoft application ID meta tag is used to specify the ID of the app that is associated with the URL.

Parameters
$content : string

The value of the Microsoft application ID meta tag.

Return values
Head

The current Head object.

msApplicationName()

Sets the Microsoft application name meta tag.

public msApplicationName(string $content) : Head

The Microsoft application name meta tag is used to specify the name of the app that is associated with the URL.

Parameters
$content : string

The value of the Microsoft application name meta tag.

Return values
Head

The current Head object.

msApplicationPackageFamilyName()

Sets the Microsoft application package family name meta tag.

public msApplicationPackageFamilyName(string $content) : Head

The Microsoft application package family name meta tag is used to specify the package family name of the app that is associated with the URL.

Parameters
$content : string

The value of the Microsoft application package family name meta tag.

Return values
Head

The current Head object.

msApplicationStarturl()

Sets the Microsoft application start URL meta tag.

public msApplicationStarturl(string $content) : Head

The Microsoft application start URL meta tag is used to specify the URL that should be opened when the user clicks on the app tile in the Windows start menu.

Parameters
$content : string

The value of the Microsoft application start URL meta tag.

Return values
Head

The current Head object.

msApplicationTooltip()

Sets the Microsoft application tooltip meta tag.

public msApplicationTooltip(string $content) : Head

The Microsoft application tooltip meta tag is used to specify the tooltip text that should be displayed when the user hovers over the app tile in the Windows start menu.

Parameters
$content : string

The value of the Microsoft application tooltip meta tag.

Return values
Head

The current Head object.

og()

Adds an OpenGraph meta tag to the head.

public og(OpenGraphTag $ogName, string $content) : Head

OpenGraph meta tags are used to provide structured data about the HTML document. They are used by Facebook and other services to provide additional information about the document, such as its title, description, and images.

Parameters
$ogName : OpenGraphTag

The name of the OpenGraph meta tag.

$content : string

The content of the OpenGraph meta tag.

Return values
Head

The current Head object.

ogDescription()

Adds an OpenGraph meta tag to the head.

public ogDescription(string $content) : Head

OpenGraph meta tags are used to provide structured data about the HTML document. They are used by Facebook and other services to provide additional information about the document, such as its title, description, and images.

Parameters
$content : string

The description of the HTML document.

Return values
Head

The current Head object.

ogDeterminer()

Adds an OpenGraph Determiner meta tag to the head.

public ogDeterminer(string $content) : Head

The OpenGraph Determiner meta tag is used to define whether the HTML document is an instant article or not.

Parameters
$content : string

The content of the og:determiner meta tag.

Return values
Head

The current Head object.

ogImage()

Adds an OpenGraph image meta tag to the head.

public ogImage(string $content) : Head

The OpenGraph image meta tag is used to define the image that is associated with the HTML document. It is used by Facebook and other services to provide additional information about the document, such as its title, description, and images.

Parameters
$content : string

The image URL.

Return values
Head

The current Head object.

ogImageHeight()

Adds an OpenGraph image height meta tag to the head.

public ogImageHeight(string $content) : Head

The OpenGraph image height meta tag is used to define the height of the image that is associated with the HTML document. It is used by Facebook and other services to provide additional information about the document, such as its title, description, and images.

Parameters
$content : string

The height of the image in pixels.

Return values
Head

The current Head object.

ogImageWidth()

Adds an OpenGraph image width meta tag to the head.

public ogImageWidth(string $content) : Head

The OpenGraph image width meta tag is used to define the width of the image that is associated with the HTML document. It is used by Facebook and other services to provide additional information about the document, such as its title, description, and images.

Parameters
$content : string

The width of the image in pixels.

Return values
Head

The current Head object.

ogLocale()

Adds an OpenGraph locale meta tag to the head.

public ogLocale(string $content) : Head

The OpenGraph locale meta tag is used to define the locale of the HTML document. It is used by Facebook and other services to provide additional information about the document, such as its title, description, and images.

Parameters
$content : string

The locale of the document (e.g. "en_US", "pl_PL", etc...).

Return values
Head

The current Head object.

ogSiteName()

Adds an OpenGraph site name meta tag to the head.

public ogSiteName(string $content) : Head

The OpenGraph site name meta tag is used to define the name of the website that the HTML document is associated with.

Parameters
$content : string

The name of the website.

Return values
Head

The current Head object.

ogTitle()

Adds an OpenGraph meta tag to the head.

public ogTitle(string $content) : Head

OpenGraph meta tags are used to provide structured data about the HTML document. They are used by Facebook and other services to provide additional information about the document, such as its title, description, and images.

Parameters
$content : string

The title of the HTML document.

Return values
Head

The current Head object.

ogType()

Adds an OpenGraph type meta tag to the head.

public ogType(string $content) : Head

The OpenGraph type meta tag is used to define the type of the HTML document. It is used by Facebook and other services to provide additional information about the document, such as its title, description, and images.

Parameters
$content : string

The type of the document (e.g. "article", "blog", etc...).

Return values
Head

The current Head object.

ogUrl()

Adds an OpenGraph URL meta tag to the head.

public ogUrl(string $content) : Head

The OpenGraph URL meta tag is used to define the canonical URL of the HTML document. It is used by Facebook and other services to determine the URL of the document.

Parameters
$content : string

The canonical URL of the HTML document.

Return values
Head

The current Head object.

property()

Sets a property node.

public property(string $name, string $content) : Head

A property node is a type of meta node that is used to define properties of the HTML document. It is commonly used to define Open Graph properties.

Parameters
$name : string

The name of the property node.

$content : string

The content of the property node.

Return values
Head

The current Head object.

rating()

Adds a rating node to the head.

public rating(string $content) : Head

A rating node is used to define the content rating of the HTML document.

Parameters
$content : string

The content rating of the HTML document.

Return values
Head

The current Head object.

revisitAfter()

Adds a revisit-after node to the head.

public revisitAfter(string $content) : Head

A revisit-after node is used to define the time after which a search engine should revisit the HTML document.

Parameters
$content : string

The time after which a search engine should revisit the HTML document.

Return values
Head

The current Head object.

robots()

Adds a robots node to the head.

public robots(string $content) : Head

A robots node is used to define the instructions that are given to web crawlers and other web robots.

Parameters
$content : string

The instructions that are given to web crawlers and other web robots.

Return values
Head

The current Head object.

script()

Adds a script node to the head.

public script(string $content[, bool $isLdJson = false ]) : Head

A script node is used to define a block of JavaScript code that is executed by the browser when the HTML document is loaded.

Parameters
$content : string

The content of the script node.

$isLdJson : bool = false

Whether the script node contains JSON-LD data.

Return values
Head

The current Head object.

scriptText()

Adds a script node with text content to the head.

public scriptText(string $content[, bool $isLdJson = false ]) : Head

A script node with text content is used to define a block of JavaScript code that is executed by the browser when the HTML document is loaded.

Parameters
$content : string

The content of the script node.

$isLdJson : bool = false

Whether the script node contains JSON-LD data.

Return values
Head

The current Head object.

shortcutIcon()

Adds a shortcut icon node to the head.

public shortcutIcon(string $content) : Head

A shortcut icon node is used to define a shortcut icon for the HTML document.

Parameters
$content : string

The shortcut icon of the HTML document.

Return values
Head

The current Head object.

stylesheet()

Adds a stylesheet node with a reference to an external CSS file to the head.

public stylesheet(string $content) : Head

A stylesheet node with a reference to an external CSS file is used to define the styles of the HTML document.

Parameters
$content : string

The URL of the external CSS file.

Return values
Head

The current Head object.

stylesheetText()

Adds a stylesheet node with inline CSS code to the head.

public stylesheetText(string $content) : Head

A stylesheet node with inline CSS code is used to define the styles of the HTML document.

Parameters
$content : string

The inline CSS code.

Return values
Head

The current Head object.

themeColor()

Adds a theme color node to the head.

public themeColor(string $content[, bool $isDarkMode = true ]) : Head

A theme color node is used to define the preferred color scheme of the HTML document.

Parameters
$content : string

The preferred color scheme of the HTML document.

$isDarkMode : bool = true

Whether to use the dark color scheme or not. If true, the dark color scheme will be used. If false, the light color scheme will be used.

Return values
Head

The current Head object.

title()

Adds a title node with the title of the HTML document to the head.

public title(string $title) : Head

A title node with the title of the HTML document is used to define the title of the HTML document.

Parameters
$title : string

The title of the HTML document.

Return values
Head

The current Head object.

viewport()

Adds a viewport node to the head.

public viewport([string|null $content = null ]) : Head

A viewport node is used to define the zooming behavior of the HTML document.

Parameters
$content : string|null = null

The content of the viewport node. If null, it will be set to the default value.

Return values
Head

The current Head object.

addNode()

Add a node to the head.

protected addNode(string $nodeName, string|null $tagName, string|null $content[, string $nameAttributePrefix = 'name' ][, string $nameAttributeSubPrefix = 'content' ][, string|null $type = null ][, string|null $typeContent = null ][, bool $endTagNode = false ]) : string

The node can either be a standalone node (i.e. <meta>) or a node with a closing tag (i.e. <title>).

If the node has a closing tag, the content of the node should be set to null.

Parameters
$nodeName : string

The name of the node (i.e. "meta", "title", etc...).

$tagName : string|null

The value of the name attribute of the node.

$content : string|null

The content of the node.

$nameAttributePrefix : string = 'name'

The prefix of the name attribute of the node.

$nameAttributeSubPrefix : string = 'content'

The sub prefix of the name attribute of the node.

$type : string|null = null

The value of the type attribute of the node.

$typeContent : string|null = null

The content of the type attribute of the node.

$endTagNode : bool = false

Whether the node has a closing tag.

Return values
string

The HTML string of the node.

metaReturn()

Meta return method

protected metaReturn(string $name, string $content) : string

This method returns a meta node HTML string.

Parameters
$name : string

The name of the meta node.

$content : string

The content of the meta node.

Return values
string

The HTML string of the meta node.

On this page

Search results