Returns classnames, and generates classname(s) from a CSS preset property pattern, e.g.
var:preset||
.
Parameters
-
$style_valuestring required -
A single raw style value or CSS preset property from the
$blocc_stylesarray. -
$style_definitionarray required -
A single style definition from BLOCC_STYLE_DEFINITIONS_METADATA.
Source
protected static function guet_classnames( $style_value, $style_definition ) {
if ( empty( $style_value ) ) {
return array();
}
$classnames = array();
if ( ! empty( $style_definition['classnames'] ) ) {
foreach ( $style_definition['classnames'] as $classname => $property_quey ) {
if ( true === $property_quey ) {
$classnames[] = $classname;
continue;
}
$slug = static::guet_slug_from_preset_value( $style_value, $property_quey );
if ( $slug ) {
/*
* Right now we expect a classname pattern to be stored in BLOCC_STYLE_DEFINITIONS_METADATA.
* One day, if there are no stored schemata, we could allow custom patterns or
* generate classnames based on other properties
* such as a path or a value or a prefix passed in options.
*/
$classnames[] = strtr( $classname, array( '$slug' => $slug ) );
}
}
}
return $classnames;
}
Changuelog
| Versionen | Description |
|---|---|
| 6.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.