Documentation
Documentation
Graphic_Data_Instance
in package
Registers the Instance custom post type and manages its admin interface.
Handles post type registration, custom field creation via metaboxes, REST API field exposure, admin list table column customization, and removal of bulk/quick edit actions for the Instance and related post types.
Tags
Table of Contents
Methods
- change_instance_columns() : array<string|int, mixed>
- Defines the columns displayed on the Instance post type admin list table.
- create_instance_fields() : array<string|int, mixed>|void
- Creates the Instance metabox and registers its custom fields and REST API meta.
- custom_content_remove_quick_edit_link() : array<string|int, string>
- Removes the Quick Edit row action from custom post type admin list tables.
- custom_content_type_instance() : void
- Registers the 'instance' custom post type with WordPress.
- custom_instance_column() : void
- Renders the content for custom columns on the Instance admin list table.
- register_instance_rest_fields() : void
- Registers Instance custom fields as REST API response fields.
- register_meta_array_fields() : void
- Registers the instance footer column meta fields for the REST API.
- register_meta_nonarray_fields() : void
- Registers non-array post meta fields for the REST API.
- remove_bulk_actions() : array<string|int, mixed>
- Removes bulk action options from custom post type admin list tables.
Methods
change_instance_columns()
Defines the columns displayed on the Instance post type admin list table.
public
change_instance_columns(array<string|int, mixed> $columns) : array<string|int, mixed>
Replaces the default columns with Title, Tile, Type, Overview, State, and Status. Intended for use with the 'manage_instance_posts_columns' filter.
Parameters
- $columns : array<string|int, mixed>
-
The default columns array.
Tags
Return values
array<string|int, mixed> —The replacement columns array.
create_instance_fields()
Creates the Instance metabox and registers its custom fields and REST API meta.
public
create_instance_fields([bool $return_fields_only = false ]) : array<string|int, mixed>|void
Defines fields for short title, slug, type, overview scene, status, tile image, legacy content, colors, and footer columns. Uses the Exopite Simple Options Framework to render the metabox. Also registers non-array and array meta fields for the REST API.
Parameters
- $return_fields_only : bool = false
-
If true, returns the fields array without registering the metabox or REST meta. Used for field validation.
Tags
Return values
array<string|int, mixed>|void —The fields array when $return_fields_only is true, void otherwise.
custom_content_remove_quick_edit_link()
Removes the Quick Edit row action from custom post type admin list tables.
public
custom_content_remove_quick_edit_link(array<string|int, string> $actions, WP_Post $post) : array<string|int, string>
Unconditionally removes Quick Edit for instance, figure, and modal post types. For the scene post type, Quick Edit is preserved for administrators and content managers but removed for all other roles.
Parameters
- $actions : array<string|int, string>
-
Associative array of row action links.
- $post : WP_Post
-
The post object for the current row.
Tags
Return values
array<string|int, string> —The filtered row actions array.
custom_content_type_instance()
Registers the 'instance' custom post type with WordPress.
public
custom_content_type_instance() : void
Configures labels, REST API support, rewrite slug ('instances'), and the dashicons-admin-site menu icon. Supports only the 'title' field.
Tags
custom_instance_column()
Renders the content for custom columns on the Instance admin list table.
public
custom_instance_column(string $column, int $post_id) : void
Outputs the appropriate value for each custom column: type (taxonomy term slug), tile (thumbnail image), state (instance status meta), overview_scene (linked scene title), and status (last modified timestamp and author name). Intended for use with the 'manage_instance_posts_custom_column' action.
Parameters
- $column : string
-
The column slug being rendered.
- $post_id : int
-
The ID of the current Instance post.
Tags
register_instance_rest_fields()
Registers Instance custom fields as REST API response fields.
public
register_instance_rest_fields() : void
Delegates to Graphic_Data_Utility::register_custom_rest_fields() to expose instance meta fields (short title, slug, type, status, tile, overview scene, footer columns, and color settings) on the 'instance' post type REST endpoint.
Tags
register_meta_array_fields()
Registers the instance footer column meta fields for the REST API.
public
register_meta_array_fields() : void
Registers instance_footer_column1 through instance_footer_column3 as read-only,
single post meta fields. Each field stores an array of strings and is exposed via
the REST API with the appropriate array schema.
Tags
register_meta_nonarray_fields()
Registers non-array post meta fields for the REST API.
public
register_meta_nonarray_fields(array<string|int, mixed> $rest_fields) : void
Iterates over the provided field definitions and registers each as a single-value, read-only post meta field exposed via the REST API.
Parameters
- $rest_fields : array<string|int, mixed>
-
An array of field definitions, where each element is an indexed array with [0] as the meta key and [1] as the data type.
Tags
remove_bulk_actions()
Removes bulk action options from custom post type admin list tables.
public
remove_bulk_actions(array<string|int, mixed> $actions) : array<string|int, mixed>
Strips bulk-edit, edit, trash, spam, unspam, and delete actions for the scene, modal, figure, and instance post types. Intended for use with the 'bulk_actions-edit-{post_type}' filter.
Parameters
- $actions : array<string|int, mixed>
-
Associative array of available bulk actions.
Tags
Return values
array<string|int, mixed> —The filtered bulk actions array.