Documentation
Documentation
Graphic_Data_Figure_Html_Rebuild
in package
Class Graphic_Data_Figure_Html_Rebuild.
Tags
Table of Contents
Constants
- FIGURE_TYPES : mixed = array('Interactive', 'Internal', 'External', 'C...
- Figure types that have standalone HTML.
- QUEUE_OPTION : mixed = 'graphic_data_figure_html_queue'
- Option listing the IDs of Figures waiting for their HTML.
- RENDER_META_KEY : mixed = '_graphic_data_render_pending'
- Hidden meta key marking an Interactive figure whose saved JSON (figure_interactive_args_rendered) is still to be built from its settings.
Methods
- dequeue() : void
- Remove a Figure from the queue.
- enqueue() : array<string|int, int>
- Add Figures to the queue. Figures that cannot have HTML are skipped.
- get_build_data() : array{figure_type: string, saved_figure: mixed, render: array|null, info_full: array, info_figure_only: array}
- What createFigureHtml() needs to build a Figure's two files: the info objects that the edit screen collects from its form, and the saved figure for Interactive figures.
- get_buildable_figures() : array<string|int, int>
- Every Figure that gets HTML, optionally only those in one Instance.
- get_queue() : array<string|int, int>
- IDs of the Figures waiting for their HTML. Figures that were deleted, or can no longer have HTML (for example their Status was set to Draft), are dropped.
- is_buildable() : bool
- Whether a Figure gets standalone HTML, by the edit screen's rules.
- needs_render() : bool
- Whether an Interactive figure's saved JSON is still to be built from its settings. An updated Figure keeps its earlier saved JSON, which the site goes on showing, until the new one is built.
- remove_html() : void
- Remove the HTML of a Figure that no longer has it, for example because an import set its Status to Draft, as the edit screen does.
- save() : true|WP_Error
- Write a Figure's two HTML files and point its meta at them, as the edit screen's save does, then remove it from the queue.
- save_render() : true|WP_Error
- Save an Interactive figure's saved JSON, built in the browser from its settings, cleaned as the edit screen cleans the field when it saves.
Constants
FIGURE_TYPES
Figure types that have standalone HTML.
public
mixed
FIGURE_TYPES
= array('Interactive', 'Internal', 'External', 'Code')
QUEUE_OPTION
Option listing the IDs of Figures waiting for their HTML.
public
mixed
QUEUE_OPTION
= 'graphic_data_figure_html_queue'
RENDER_META_KEY
Hidden meta key marking an Interactive figure whose saved JSON (figure_interactive_args_rendered) is still to be built from its settings.
public
mixed
RENDER_META_KEY
= '_graphic_data_render_pending'
Methods
dequeue()
Remove a Figure from the queue.
public
static dequeue(int $figure_id) : void
Parameters
- $figure_id : int
-
Figure ID.
enqueue()
Add Figures to the queue. Figures that cannot have HTML are skipped.
public
static enqueue(array<string|int, int> $figure_ids) : array<string|int, int>
Parameters
- $figure_ids : array<string|int, int>
-
Figure IDs.
Return values
array<string|int, int> —The IDs that were queued.
get_build_data()
What createFigureHtml() needs to build a Figure's two files: the info objects that the edit screen collects from its form, and the saved figure for Interactive figures.
public
static get_build_data(int $figure_id) : array{figure_type: string, saved_figure: mixed, render: array|null, info_full: array, info_figure_only: array}
When the figure's saved JSON is still to be built, render holds its
settings and saved_figure is null.
Parameters
- $figure_id : int
-
Figure ID.
Return values
array{figure_type: string, saved_figure: mixed, render: array|null, info_full: array, info_figure_only: array}get_buildable_figures()
Every Figure that gets HTML, optionally only those in one Instance.
public
static get_buildable_figures([int $instance_id = 0 ]) : array<string|int, int>
Parameters
- $instance_id : int = 0
-
Instance ID, or 0 for every Figure.
Return values
array<string|int, int>get_queue()
IDs of the Figures waiting for their HTML. Figures that were deleted, or can no longer have HTML (for example their Status was set to Draft), are dropped.
public
static get_queue() : array<string|int, int>
Return values
array<string|int, int>is_buildable()
Whether a Figure gets standalone HTML, by the edit screen's rules.
public
static is_buildable(int $figure_id) : bool
Parameters
- $figure_id : int
-
Figure ID.
Return values
boolneeds_render()
Whether an Interactive figure's saved JSON is still to be built from its settings. An updated Figure keeps its earlier saved JSON, which the site goes on showing, until the new one is built.
public
static needs_render(int $figure_id) : bool
Parameters
- $figure_id : int
-
Figure ID.
Return values
boolremove_html()
Remove the HTML of a Figure that no longer has it, for example because an import set its Status to Draft, as the edit screen does.
public
static remove_html(int $figure_id) : void
Parameters
- $figure_id : int
-
Figure ID.
save()
Write a Figure's two HTML files and point its meta at them, as the edit screen's save does, then remove it from the queue.
public
static save(int $figure_id, string $full_html, string $figure_only_html) : true|WP_Error
Parameters
- $figure_id : int
-
Figure ID.
- $full_html : string
-
figure-<ID>.html content.
- $figure_only_html : string
-
figure-<ID>_figure_only.html content.
Return values
true|WP_Errorsave_render()
Save an Interactive figure's saved JSON, built in the browser from its settings, cleaned as the edit screen cleans the field when it saves.
public
static save_render(int $figure_id, string $rendered) : true|WP_Error
Parameters
- $figure_id : int
-
Figure ID.
- $rendered : string
-
JSON.