AttachmentModel final class
Minn\Runtime\AttachmentModel · public/minn/src/Minn/Runtime/AttachmentModel.php · 96 lines
An attachment as the media modal's scripts read it (wp_prepare_attachment_for_js): its fields, its file and its sizes, and what the visitor may do with it. The nonces the modal saves, deletes and edits with, the links to edit the attachment and its author, and the post it was uploaded to are there only for a visitor allowed each, as the reference gives them. The model passes through wp_prepare_attachment_for_js.
Constants and properties
| private | FIELDS = array ( 0 => 'id', 1 => 'title', 2 => 'filename', 3 => 'url', 4 => 'link', 5 => 'alt', 6 => 'author', 7 => 'description', 8 => 'caption', 9 => 'name', 10 => 'status', 11 => 'uploadedTo', 12 => 'date', 13 => 'modified', 14 => 'menuOrder', 15 => 'mime', 16 => 'type', 17 => 'subtype', 18 => 'icon', 19 => 'dateFormatted', 20 => 'nonces', 21 => 'editLink', 22 => 'meta', ) | The model's first fields, in the order the reference sends them. |
Public
| static | forJs(mixed $attachment): mixed# | The model, or null for anything that is not an attachment. |
Internals 1
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | people(object $post): array# | Who uploaded the attachment and to which post: the author's name, and a link to edit them where one may (none for an author no longer a user); the post's title and edit link for a visitor who may read it. @return array<string, mixed> |
Nothing matches.