Documentation

Tags
in package

No description yet.

Table of Contents

Methods

beginsWith()  : array<string|int, mixed>
Returns all tags which begin with a given string
byRecord()  : array<string|int, mixed>
Returns all of the tags for a given record
byTable()  : array<string|int, mixed>
Returns all of the tags for a given table
findRecords()  : array<string|int, mixed>
Returns all of the records for a given table/tag
getList()  : string
Get HTML for a tag list (i.e. for tag display on the front-end)
recordCounts()  : array<string|int, mixed>
Return the tags for a table, along with the number of records for each tag
recordCountsPerSubsite()  : array<string|int, mixed>
Return the tags for a table, along with the number of records for each tag Results are filtered by subsite, including records with subsite_id of NULL which is all sites
splitupTags()  : array<string|int, mixed>
Converts a comma-separated string into a list of tags
suggestTags()  : array<string|int, mixed>
Returns common tags. Typically tags are returned from the provided table, but not necessarily.
update()  : bool
Updates tags for a given record

Methods

beginsWith()

Returns all tags which begin with a given string

public static beginsWith(string $prefix) : array<string|int, mixed>
Parameters
$prefix : string

Search prefix

Tags
throws
QueryException
Return values
array<string|int, mixed> —

Tags

byRecord()

Returns all of the tags for a given record

public static byRecord(string $table, int $record_id) : array<string|int, mixed>
Parameters
$table : string
$record_id : int
Tags
throws
QueryException
Return values
array<string|int, mixed> —

Tags

byTable()

Returns all of the tags for a given table

public static byTable(string $table) : array<string|int, mixed>
Parameters
$table : string
Tags
throws
QueryException
Return values
array<string|int, mixed> —

Tags

findRecords()

Returns all of the records for a given table/tag

public static findRecords(string $table, string $tag) : array<string|int, mixed>
Parameters
$table : string

Table name

$tag : string

Tag name

Tags
throws
QueryException
Return values
array<string|int, mixed> —

Record IDs

getList()

Get HTML for a tag list (i.e. for tag display on the front-end)

public static getList([array<string|int, mixed>|null $tags = null ]) : string
Parameters
$tags : array<string|int, mixed>|null = null
Return values
string —

HTML

recordCounts()

Return the tags for a table, along with the number of records for each tag

public static recordCounts(string $table, int $limit) : array<string|int, mixed>
Parameters
$table : string

Table to get counts for, e.g 'blog_posts'

$limit : int

Maximum number of tags to return. Use 999999 for "unlimited".

Tags
example

$tags = Tags::recordCounts('blog_posts', 50); foreach ($tags as $tag => $count) { echo Enc::html($tag), ' (', $count, ')'; }

Return values
array<string|int, mixed> —

Keys are tag names, values are counts

recordCountsPerSubsite()

Return the tags for a table, along with the number of records for each tag Results are filtered by subsite, including records with subsite_id of NULL which is all sites

public static recordCountsPerSubsite(string $table, int $limit[, int $subsite_id = null ]) : array<string|int, mixed>
Parameters
$table : string

Table to get counts for, e.g 'blog_posts'

$limit : int

Maximum number of tags to return. Use 999999 for "unlimited".

$subsite_id : int = null

Subsite to return record counts for; NULL for current subsite

Tags
example

$tags = Tags::recordCountsPerSubsite('blog_posts', 50, SubsiteSelector::$subsite_id); foreach ($tags as $tag => $count) { echo Enc::html($tag), ' (', $count, ')'; }

Return values
array<string|int, mixed> —

Keys are tag names, values are counts

splitupTags()

Converts a comma-separated string into a list of tags

public static splitupTags(string $string) : array<string|int, mixed>
Parameters
$string : string
Return values
array<string|int, mixed> —

Tags

suggestTags()

Returns common tags. Typically tags are returned from the provided table, but not necessarily.

public static suggestTags([string $table = null ][, string $prefix = '' ][, int $number = 10 ]) : array<string|int, mixed>
Parameters
$table : string = null
$prefix : string = ''
$number : int = 10
Tags
throws
QueryException
Return values
array<string|int, mixed> —

Tags

update()

Updates tags for a given record

public static update(string $table, int $record_id, array<string|int, mixed> $new_tags[, bool $remove = true ]) : bool
Parameters
$table : string

The table name of the record which is being updated

$record_id : int

The record to update

$new_tags : array<string|int, mixed>

Array of tag names of the new tags

$remove : bool = true

Should removals be processed? Set to FALSE to only add tags. Default true.

Tags
throws
QueryException
Return values
bool —

True on success, false on failure

On this page

Search results