API / Minn\Runtime / TermTags

TermTags final class

Minn\Runtime\TermTags · public/minn/src/Minn/Runtime/TermTags.php · 364 lines

What WordPress's template tags tell about a post's terms: its terms of a taxonomy (as a list primed them, else read), its categories with their old field names, its tags, its format, and a category's address and the chain of its parents.

Constants and properties

privateCATEGORY_FIELDS = array ( 'cat_ID' => 'term_id', 'category_count' => 'count', 'category_description' => 'description', 'cat_name' => 'name', 'category_nicename' => 'slug', 'category_parent' => 'parent', )

A category's old field names, each with the term field it mirrors, in the order they are added.

Public

staticcached(mixed $id, mixed $taxonomy): mixed#

The terms of a post that a list primed or the object cache holds (get_object_term_cache), each through get_term; false when nothing holds them.

staticformatStrings(): array#

The post formats' names (get_post_format_strings), in the site's language, by slug.

@return array<string, string>
staticofPost(mixed $post, mixed $taxonomy): mixed#

A post's terms of a taxonomy (get_the_terms), as get_the_terms leaves them; false for none or no post.

staticcategories(mixed $postId = false): mixed#

A post's categories (get_the_category), each with its old field names, as get_the_categories leaves them.

statictags(mixed $post = 0): mixed#

A post's tags (get_the_tags), as get_the_tags leaves them.

staticformat(mixed $post = NULL): mixed#

A post's format (get_post_format): its post_format term's slug without the prefix; false for none or a type without formats.

staticcategoryFields(mixed $category): void#

A category's old field names beside its term fields (_make_cat_compat), on a term object or a term array alike.

staticcategoryLink(mixed $category): mixed#

A category's address (get_category_link), empty for none.

staticcategoryParents(mixed $categoryId, mixed $link = false, mixed $separator = '/', mixed $nicename = false, mixed $deprecated = array ( )): mixed#

A category's parents and itself, outermost first (get_category_parents), as names or slugs, linked or not, with the separator after each; the error for an unknown category.

staticcacheObjects(mixed $objectIds, mixed $objectType): void#

Each taxonomy's term ids of the objects not cached yet, kept in {taxonomy}_relationships (update_object_term_cache); an object cached there keeps its entry, and one without terms gets an empty list.

staticcleanObjects(mixed $objectIds, mixed $objectType): void#

The objects' term caches let go (clean_object_term_cache): each of the type's taxonomies' relationships, the terms' last_changed moved, then plugins told; nothing at all while cache invalidation is suspended.

staticattachmentTaxonomies(mixed $attachment, mixed $output = 'names'): array#

The taxonomies an attachment carries (get_attachment_taxonomies): those registered for attachments, for its file's extension, its MIME type, and each half of it (attachment:image, attachment:image/png...).

statictaxonomies(mixed $post = 0, mixed $args = array ( )): array#

A post's taxonomies as sentences of term links (get_the_taxonomies): a taxonomy's own template and term_template win over the ones given; the terms list through wp_sprintf's %l; an attachment's file types count; a taxonomy without terms is left out.

@return array<string, string>
staticobjectInTerm(mixed $objectId, mixed $taxonomy, mixed $terms = NULL): mixed#

Whether an object has one of the terms (is_object_in_term): an integer is an id, a digit string an id, a name or a slug, any other string a name or a slug; no terms asked means any term of the taxonomy. An error for no object (0) or an unknown taxonomy.

staticcloudCountText(int $count, mixed $tag, array $args): string#

The tag cloud's count in words for a tag's label: topic_count_text (a nooped plural) first, then the text callback (default_topic_count_text counts as none), then the old single_text and multiple_text, else "%s item" / "%s items" (probe taxonomy-blocks-user-doubts).

staticallLink(string $taxonomy): string#

The category list's "all" link for a taxonomy: the archive of its first type when none of its types is a post, else the posts page or the home page (probe taxonomy-blocks-user-doubts).

staticbindingValue(array $sourceArgs, mixed $block): mixed#

A term's field for the core/term-data binding (_block_bindings_term_data_get_value): a navigation link or submenu by its own id and type ("tag" is post_tag), any other block by the termId and taxonomy in its context; id, count and parent as text, the name, slug, description or link. Null for no term, or a term of a hidden taxonomy to someone who may not edit it (probe taxonomy-blocks-user-doubts).