Skip to content
Docs
Get RestroPress

Filter

rpress_pack_component_schema

Updated
On this page

Filters the component settings a template pack may set, and the type of each.

The schema validates a pack's components values. A type is 'css' (one CSS value), 'px' or 'int' (non-negative whole number), 'bool', or a list of allowed values; unknown components and settings, and invalid values, are dropped. Core's CSS builder only handles its own settings, so a setting you add needs your own code to produce any styling.

Available since RestroPress 3.5.1.

Parameters#

ParameterTypeDescription
$schemaarrayComponent => setting => type. Core components include card, menu, section, tabs, rail, masthead, service, sheet and allergens.

Return value#

array. Schema in the same shape.

Example#

add_filter( 'rpress_pack_component_schema', 'my_component_schema', 10, 1 );
function my_component_schema( $schema ) {
	$schema['card']['hover_color'] = 'css';
	return $schema;
}

Notes#

Template packs are registered on init priority 5 and validated then, so add the filter before that.

Source#

Applied in:

  • includes/features/storefront-layout/components.php (line 38), in rpress_pack_component_schema()

See also#

Was this page helpful?