CustomHeadTags
in package
Management of custom HEAD tags. Often meta but can also be link, base, etc
Table of Contents
Methods
- addHeadTags() : void
- Render the custom meta tags for the current record
- getAvailableAttributes() : array<string|int, mixed>
- Get the list of available attributes for the given tag type and tag
- getAvailableTagList() : array<string|int, mixed>
- Get the list of available tags, allowing override from src/config if set
- getAvailableTags() : array<string|int, mixed>
- Get the list of available tags for the given tag type
- getCanonicalURL() : string|null
- Return a canonical URL for the current record if set in custom meta
- getTags() : array<string|int, mixed>
- Get the list of tags set for the current record
- outputTagsFormElement() : void
- Render and echo the form element for the custom meta tags
- renderGenericTag() : string
- Build a single generic (non-script tag)
- renderTagsFormElement() : string
- Render the form element for the custom meta tags
- saveTags() : void
- Save the custom meta tags for the given record
- addTagNeeds() : void
- Perform the actual echoing of the tags
- buildTagsData() : array<string|int, mixed>
- Build the data array for saving the tags, excluding the record ID
- renderScriptTag() : string
- Build a single script tag
Methods
addHeadTags()
Render the custom meta tags for the current record
public
static addHeadTags(string $table_name, int $record_id) : void
Parameters
- $table_name : string
- $record_id : int
getAvailableAttributes()
Get the list of available attributes for the given tag type and tag
public
static getAvailableAttributes(string $tag_type, string $tag) : array<string|int, mixed>
Parameters
- $tag_type : string
-
The tag type to get the list for
- $tag : string
-
The tag to get the list for
Return values
array<string|int, mixed>getAvailableTagList()
Get the list of available tags, allowing override from src/config if set
public
static getAvailableTagList() : array<string|int, mixed>
Return values
array<string|int, mixed>getAvailableTags()
Get the list of available tags for the given tag type
public
static getAvailableTags(string $tag_type) : array<string|int, mixed>
Parameters
- $tag_type : string
-
The tag type to get the list for
Return values
array<string|int, mixed>getCanonicalURL()
Return a canonical URL for the current record if set in custom meta
public
static getCanonicalURL(string $table_name, int $record_id) : string|null
Parameters
- $table_name : string
- $record_id : int
Return values
string|nullgetTags()
Get the list of tags set for the current record
public
static getTags(string $table_name, int $record_id) : array<string|int, mixed>
Parameters
- $table_name : string
- $record_id : int
-
The record ID to get the tags for
Return values
array<string|int, mixed>outputTagsFormElement()
Render and echo the form element for the custom meta tags
public
static outputTagsFormElement(string $table_name, int $record_id) : void
Parameters
- $table_name : string
-
The table_name to get the tags for
- $record_id : int
-
The record ID to get the tags for
Return values
void —Outputs HTML directly
renderGenericTag()
Build a single generic (non-script tag)
public
static renderGenericTag(array<string|int, mixed> $tag) : string
Parameters
- $tag : array<string|int, mixed>
-
The tag contents array
Return values
string —The completed HTML tag string
renderTagsFormElement()
Render the form element for the custom meta tags
public
static renderTagsFormElement(string $table_name, int $record_id) : string
Parameters
- $table_name : string
-
The table_name to get the tags for
- $record_id : int
-
The record ID to get the tags for
Return values
stringsaveTags()
Save the custom meta tags for the given record
public
static saveTags(string $table_name, int $record_id, array<string|int, mixed> $tags) : void
Parameters
- $table_name : string
-
The table_name to save the tags for
- $record_id : int
-
The record ID to save the tags for
- $tags : array<string|int, mixed>
-
The tags to save
addTagNeeds()
Perform the actual echoing of the tags
protected
static addTagNeeds(array<string|int, mixed> $tags) : void
Parameters
- $tags : array<string|int, mixed>
buildTagsData()
Build the data array for saving the tags, excluding the record ID
protected
static buildTagsData(array<string|int, mixed> $tags) : array<string|int, mixed>
Parameters
- $tags : array<string|int, mixed>
-
The tags to save
Return values
array<string|int, mixed>renderScriptTag()
Build a single script tag
private
static renderScriptTag(array<string|int, mixed> $tag) : string
Note this works a bit differently as the first attr value is the content inside the tag core
Parameters
- $tag : array<string|int, mixed>
-
The tag contents array
Return values
string —The completed HTML tag string