API / Minn\Runtime / TermFields

TermFields final class

Minn\Runtime\TermFields · public/minn/src/Minn/Runtime/TermFields.php · 65 lines

A term's fields in a context, as the reference's sanitize_term_field treats them (probe term-sanitize): the numeric fields are whole numbers, never below zero, in every context, and raw stops there. edit runs edit_term_{field} and edit_{taxonomy}_{field}; db runs pre_term_{field} and pre_{taxonomy}_{field}, where the saving defaults live, and a slug also pre_category_nicename; rss runs term_{field}_rss and {taxonomy}_{field}_rss; any other context runs term_{field} and {taxonomy}_{field} with the context named. Then a text field is escaped for where it goes: a form (edit), an attribute, a script (js).

Constants and properties

constFIELDS = array ( 0 => 'term_id', 1 => 'name', 2 => 'description', 3 => 'slug', 4 => 'count', 5 => 'parent', 6 => 'term_group', 7 => 'term_taxonomy_id', 8 => 'object_id', )

The fields sanitize_term runs, in its order.

privateNUMBERS = array ( 0 => 'parent', 1 => 'term_id', 2 => 'count', 3 => 'term_group', 4 => 'term_taxonomy_id', 5 => 'object_id', )
privateESCAPES = array ( 'edit' => 'esc_html', 'attribute' => 'esc_attr', 'js' => 'esc_js', )

Public

staticfield(string $field, mixed $value, int $termId, string|false $taxonomy, string $context): mixed#

One field's value in a context; a lookup with no taxonomy names false, and its filters get false.

staticterm(object|array $term, string $taxonomy, string $context): object|array#

A term (object or array) with each of its fields in the context, and its filter set to the context; the term's own id goes to the filters.

$termT

Internals 2

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatefiltered(string $field, mixed $value, int $termId, string|false $taxonomy, string $context): mixed#

The field's own filters for the context, in the reference's order.

privatesaving(string $field, mixed $value, string|false $taxonomy): mixed#

The db context's filters: the field's, the taxonomy's, and a slug's old category one.