HtmlBlock
extends ContentBlock
in package
implements
HtmlBlockInterface
HtmlBlock
Table of Contents
Interfaces
- HtmlBlockInterface
- Interface HtmlBlockInterface
Properties
- $blocks : array<string|int, mixed>
- $cached : bool
- $checksum : string
- $content : string
- $frameworks : array<string|int, mixed>
- $html : array<string|int, mixed>
- $id : string
- $links : array<string|int, mixed>
- $scripts : array<string|int, mixed>
- $styles : array<string|int, mixed>
- $tokenTemplate : string
- $version : int
Methods
- __construct() : mixed
- Block constructor.
- __serialize() : array<string|int, mixed>
- __toString() : string
- __unserialize() : void
- addBlock() : $this
- addFramework() : $this
- addHtml() : bool
- addInlineModule() : bool
- Shortcut for writing addInlineScript(['type' => 'module', 'content' => ...]).
- addInlineScript() : bool
- addInlineStyle() : bool
- addLink() : bool
- addModule() : bool
- Shortcut for writing addScript(['type' => 'module', 'src' => ...]).
- addScript() : bool
- addStyle() : bool
- build() : void
- create() : static
- disableCache() : $this
- fromArray() : ContentBlockInterface
- getAssets() : array<string|int, mixed>
- getChecksum() : string
- getFrameworks() : array<string|int, mixed>
- getHtml() : array<string|int, mixed>
- getId() : string
- getLinks() : array<string|int, mixed>
- getScripts() : array<string|int, mixed>
- getStyles() : array<string|int, mixed>
- getToken() : string
- isCached() : bool
- serialize() : string
- setChecksum() : $this
- setContent() : $this
- toArray() : array<string|int, mixed>
- toString() : string
- unserialize() : void
- checkVersion() : void
- generateId() : string
- getAssetsFast() : array<string|int, mixed>
- getAssetsInLocation() : array<string|int, mixed>
- getUnserializeAllowedClasses() : array<string|int, mixed>|bool
- sortAssets() : void
- sortAssetsInLocation() : void
Properties
$blocks
protected
array<string|int, mixed>
$blocks
= []
$cached
protected
bool
$cached
= true
$checksum
protected
string
$checksum
$content
protected
string
$content
= ''
$frameworks
protected
array<string|int, mixed>
$frameworks
= []
$html
protected
array<string|int, mixed>
$html
= []
$id
protected
string
$id
$links
protected
array<string|int, mixed>
$links
= []
$scripts
protected
array<string|int, mixed>
$scripts
= []
$styles
protected
array<string|int, mixed>
$styles
= []
$tokenTemplate
protected
string
$tokenTemplate
= '@@BLOCK-%s@@'
$version
protected
int
$version
= 1
Methods
__construct()
Block constructor.
public
__construct([string|null $id = null ]) : mixed
Parameters
- $id : string|null = null
__serialize()
public
final __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__toString()
public
__toString() : string
Attributes
- #[ReturnTypeWillChange]
Return values
string__unserialize()
public
final __unserialize(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
addBlock()
public
addBlock(ContentBlockInterface $block) : $this
Parameters
- $block : ContentBlockInterface
Return values
$thisaddFramework()
public
addFramework(string $framework) : $this
Parameters
- $framework : string
Return values
$thisaddHtml()
public
addHtml(string $html[, int $priority = 0 ][, string $location = 'bottom' ]) : bool
Parameters
- $html : string
- $priority : int = 0
- $location : string = 'bottom'
Return values
booladdInlineModule()
Shortcut for writing addInlineScript(['type' => 'module', 'content' => ...]).
public
addInlineModule(string|array<string|int, mixed> $element[, int $priority = 0 ][, string $location = 'head' ]) : bool
Parameters
- $element : string|array<string|int, mixed>
- $priority : int = 0
- $location : string = 'head'
Return values
booladdInlineScript()
public
addInlineScript(string|array<string|int, mixed> $element[, int $priority = 0 ][, string $location = 'head' ]) : bool
Parameters
- $element : string|array<string|int, mixed>
- $priority : int = 0
- $location : string = 'head'
Return values
booladdInlineStyle()
public
addInlineStyle(string|array<string|int, mixed> $element[, int $priority = 0 ][, string $location = 'head' ]) : bool
Parameters
- $element : string|array<string|int, mixed>
- $priority : int = 0
- $location : string = 'head'
Return values
booladdLink()
public
addLink(array<string|int, mixed> $element[, int $priority = 0 ][, string $location = 'head' ]) : bool
Parameters
- $element : array<string|int, mixed>
- $priority : int = 0
- $location : string = 'head'
Return values
booladdModule()
Shortcut for writing addScript(['type' => 'module', 'src' => ...]).
public
addModule(string|array<string|int, mixed> $element[, int $priority = 0 ][, string $location = 'head' ]) : bool
Parameters
- $element : string|array<string|int, mixed>
- $priority : int = 0
- $location : string = 'head'
Return values
booladdScript()
public
addScript(string|array<string|int, mixed> $element[, int $priority = 0 ][, string $location = 'head' ]) : bool
Parameters
- $element : string|array<string|int, mixed>
- $priority : int = 0
- $location : string = 'head'
Return values
booladdStyle()
public
addStyle(string|array<string|int, mixed> $element[, int $priority = 0 ][, string $location = 'head' ]) : bool
Parameters
- $element : string|array<string|int, mixed>
- $priority : int = 0
- $location : string = 'head'
Tags
Return values
boolbuild()
public
build(array<string|int, mixed> $serialized) : void
Parameters
- $serialized : array<string|int, mixed>
Tags
create()
public
static create([string|null $id = null ]) : static
Parameters
- $id : string|null = null
Return values
staticdisableCache()
public
disableCache() : $this
Return values
$thisfromArray()
public
static fromArray(array<string|int, mixed> $serialized) : ContentBlockInterface
Parameters
- $serialized : array<string|int, mixed>
Tags
Return values
ContentBlockInterfacegetAssets()
public
getAssets() : array<string|int, mixed>
Return values
array<string|int, mixed>getChecksum()
public
getChecksum() : string
Return values
stringgetFrameworks()
public
getFrameworks() : array<string|int, mixed>
Return values
array<string|int, mixed>getHtml()
public
getHtml([string $location = 'bottom' ]) : array<string|int, mixed>
Parameters
- $location : string = 'bottom'
Return values
array<string|int, mixed>getId()
public
getId() : string
Return values
stringgetLinks()
public
getLinks([string $location = 'head' ]) : array<string|int, mixed>
Parameters
- $location : string = 'head'
Return values
array<string|int, mixed>getScripts()
public
getScripts([string $location = 'head' ]) : array<string|int, mixed>
Parameters
- $location : string = 'head'
Return values
array<string|int, mixed>getStyles()
public
getStyles([string $location = 'head' ]) : array<string|int, mixed>
Parameters
- $location : string = 'head'
Return values
array<string|int, mixed>getToken()
public
getToken() : string
Return values
stringisCached()
public
isCached() : bool
Return values
boolserialize()
public
final serialize() : string
Return values
stringsetChecksum()
public
setChecksum(string $checksum) : $this
Parameters
- $checksum : string
Return values
$thissetContent()
public
setContent(string $content) : $this
Parameters
- $content : string
Return values
$thistoArray()
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>toString()
public
toString() : string
Return values
stringunserialize()
public
final unserialize(string $serialized) : void
Parameters
- $serialized : string
checkVersion()
protected
checkVersion(array<string|int, mixed> $serialized) : void
Parameters
- $serialized : array<string|int, mixed>
Tags
generateId()
protected
generateId() : string
Return values
stringgetAssetsFast()
protected
getAssetsFast() : array<string|int, mixed>
Return values
array<string|int, mixed>getAssetsInLocation()
protected
getAssetsInLocation(string $type, string $location) : array<string|int, mixed>
Parameters
- $type : string
- $location : string
Return values
array<string|int, mixed>getUnserializeAllowedClasses()
protected
getUnserializeAllowedClasses() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|boolsortAssets()
protected
sortAssets(array<string|int, mixed> &$array) : void
Parameters
- $array : array<string|int, mixed>
sortAssetsInLocation()
protected
sortAssetsInLocation(array<string|int, mixed> &$items) : void
Parameters
- $items : array<string|int, mixed>