Terms final readonly class
Minn\Content\Terms · public/minn/src/Minn/Content/Terms.php · 219 lines
Constants and properties
| private | readonly Minn\Db $db | Promoted from the constructor. |
Public
| new | __construct(Minn\Db $db)# | ||||
| method | findBySlug(string $taxonomy, string $slug): ?Minn\Content\TermRecord# | A term joined with its taxonomy row: term_id, name, slug, term_taxonomy_id, parent, count. | |||
| method | find(string $taxonomy, int $termId): ?Minn\Content\TermRecord# | One term in a taxonomy, or null. | |||
| method | row(int $termId, string $taxonomy): ?Minn\Content\TermRecord# | The row shape the term controllers work with, including term_taxonomy_id. | |||
| method | idByName(string $name, string $taxonomy): ?int# | The id of the term with exactly this name in a taxonomy, or null. | |||
| method | uniqueSlug(string $base, string $taxonomy, int $skipId = 0): string# | A slug unique within the taxonomy: base, -2, -3 on collision. | |||
| method | create(string $name, string $slug, string $taxonomy, string $description, int $parent): int# | Inserts a term and its taxonomy row and returns the term id. | |||
| method | insertRow(array $data): int# | Inserts a terms row alone (name, slug, term_group), as the reference writes it before the taxonomy row; returns the term id.
| |||
| method | addToTaxonomy(int $termId, string $taxonomy, string $description, int $parent): int# | Puts a term in a taxonomy; returns the term_taxonomy id. | |||
| method | updateRow(int $termId, array $data): void# | Rewrites a terms row (name, slug, term_group).
| |||
| method | dropRows(int $termId, int $ttId): void# | Drops a term's rows that a plugin's duplicate check said to give up. | |||
| method | rename(int $termId, string $name, string $slug): void# | Changes a term's name and slug. | |||
| method | describe(int $termId, string $taxonomy, string $description, int $parent): void# | Changes a term's description and parent within one taxonomy. | |||
| method | delete(Minn\Content\TermRecord $term, bool $hierarchical): void# | Reparents children to the grandparent, detaches relationships, drops the rows. | |||
| method | pathOf(Minn\Content\TermRecord $term): string# | "parent/child" for hierarchical taxonomies, the bare slug otherwise. |
Internals 3
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | record(?array $row): ?Minn\Content\TermRecord# |
| |||
| private | refreshHierarchy(string $taxonomy): void# | The reference keeps "{taxonomy}_children" (each parent's child term ids, by id) for a hierarchical taxonomy and rewrites it on every term change; one left stale hides new children from WordPress after a switch back. Callers take a taxonomy as hierarchical when the change has a parent, they know it is, or the option is already there. | |||
| private | keepsHierarchy(string $taxonomy): bool# | Whether the taxonomy already has its children option, the mark of a hierarchical one. |
Nothing matches.