Custom Classes
Json

JSON

Class for adding and extending theme.json via PHP.

get_json

Get the json for a given path.

  • $path: string — path to json.

get_json_output

Get output value for the json type.

  • $path: string — Path to json.

get_config_path

Get the config path based on the type and target.

  • $type: string — config type. blocks, config, theme.
  • $target: string — Target. Optional. Block name.
  • $default_config: boolean — Whether or not the default config should be returned.

get_key

For a string do nothing, return a dynamic function call or a static variable name.

  • $key: string — key to instantiate.

get_config_post_types

For each value in the config, split shared post type keys and call class values if valid.

  • $config: array — config array from json.

get_block_json

For a given block, attempt to get the json.

  • $block_name: string — Block slug.
  • $post_type: string — Post type slug.

get_brand_config_json

Combine the brand (defaults) and brand (specific) configurations.

Filters

pmc_gutenberg_brand_config_json

Filter the config that is used to enable the block editor.

  • Define the config. Favor the new feature, fallback to the legacy features.
  • $config: array — array of config arrays by post type.

get_default_json

Get the features default pmc-brand json from the config directory.

  • $post_type: string — Post type slug.
  • $type: string — Get type of theme json file. Default theme. Optional. Options, theme, config, block (requires target), or template.
  • $target: string — Subtype target. Optional.
  • $raw: bool — Whether or not to output the raw values.
  • $default: bool — Whether or not we should fallback to the default values.

get_brand_json

Get the features json from the config directory.

  • $post_type: string — Post type slug.
  • $type: string — Get type of theme json file. Default theme. Optional. Options, theme, config, block (requires target), or template.
  • $target: string — Subtype target. Optional.
  • $raw: bool — Whether or not to output the raw values.

get_output_chain

Return brand and brand defaults before defaults by post type.

  • $brand: array — brand array.
  • $default: array — default config array.
  • $post_type: string — post type slug.

recursive_merge_with_priority

Recursively merge two arrays, but favor the input overrides over the defaults.

  • $defaults: array — default array.
  • $overrides: array — override array.

Theme JSON

Class for adding and extending theme.json via PHP.

get_default_brand

Determines the brand default slug.

get_brand_name

Get brand slug from defined global var.

Filters

pmc_gutenberg_define_theme_brand

Define the theme brand via filter.

  • $brand: string — Brand slug.

filter_theme_json

Filter theme json in PHP for nova hub feature sets.

  • $theme_json: WP_Theme_JSON_Data — theme json object.

Filters

pmc_gutenberg_theme_json_defaults

Define the theme json defaults for all brands.

  • $theme_json_defaults: array — default theme.json array values shared by all brands.
pmc_gutenberg_theme_json_data

Filter the theme json data.

  • $theme_json_data: array — Theme json data.

filter_color_palette

Support only colors provided by theme's Larva tokens.

  • $theme_json_data: array — Theme JSON.

Filters

pmc_modify_editor_color_pallete

Filter the color palette used in the block editor.

  • Allowing the theme to add additional colors.
  • $editor_color_palette: array — Color palette.