$version
$version : string
Fluent_Options_Meta. Create and stores fields and sections.
__construct(array $args, array $sections) : \none
__construct() parse arguments supplied, setup framework options class.
array | $args | framework setup arguments. Used to change some base settings for the options including context. |
array | $sections | the sections an fields to be used. |
load_post_page() : \none
Hooks into the load post page so we can add a filter to the admn notices just on these pages, which in turn we use to add icons to the metabox titles.
Its important this is done here and not before or we will see icons in the screen options menu.
load_meta(object $post) : \none
The <code>load_meta</code> function is a replication of the <code>load_page</code> function, but tailored for adding meta boxes to post and cpt pages only.
In the function we prepare the sections, enqueue styles and scripts, localize scripts. We then add metaboxes and add screen settings.
object | $post | WP_Post object |
save_meta(\integar $post_id, object $post) : \none
The <code>save_meta</code> function is hooked on the save post action and will be supplied with the $post_id and $post object.
We use this to save the data supplied by the meta boxes into post meta values.
\integar | $post_id | ID of the post |
object | $post | WP_Post object |
register_field_type(array $field) : \none
Register a field type for use by the framework.
Static interface used so field types can be regsitered at any point, and for any istance of the class.
array | $field | the data to be supplied. Should be an array similar to:
|
prepare_sections(array $sections, $id) : \none
Loops through supplied data and prepares the $sections array.
This is different for each type of options so lets leave it blank
array | $sections | framework setup arguments. Used to change some base settings for the options including context. |
$id |
prepare_fields(array $fields, array $options, string $key) : array
Loops through supplied data and prepares the $fields array.
Function may also call itself on nested fields (groups). Returns a multilevel fields array.
array | $fields | |
array | $options | |
string | $key |
remove_clones(array $value) : array
Saving the options usually means the <code>$_POST</code> array conatins the group clones in the array keys.
These usually look like ##field-id-clone##
. this function simply looks for the existance of two hashes at the start of the supplied keys and removes them from the returning array if present.
array | $value | data supplied from the save action. |
$out the sanitized and trimmed array data.
prepare_meta_box_titles(string $context) : \none
The prepare meta box titles function is used to run through all the sections, check if a dashicon is to be prepended to the title, and if it is alter the global <code>$wp_meta_boxes</code> titles accordingly.
string | $context | which meta boxes we are going to alter. |
parse_args(array $a, array $b, string $filter) : array
Recursive array merging from a default and supplied array.
Very similar function to wp_parse_args
except it filters through the whole array tree.
array | $a | supplied value array. |
array | $b | default value array. |
string | $filter | optionally run the array through |