get_classnames example

        foreach ( static::BLOCK_STYLE_DEFINITIONS_METADATA as $definition_group_key => $definition_group_style ) {
            if ( empty( $block_styles[ $definition_group_key ] ) ) {
                continue;
            }
            foreach ( $definition_group_style as $style_definition ) {
                $style_value = _wp_array_get( $block_styles$style_definition['path'], null );

                if ( ! static::is_valid_style_value( $style_value ) ) {
                    continue;
                }

                $parsed_styles['classnames']   = array_merge( $parsed_styles['classnames']static::get_classnames( $style_value$style_definition ) );
                $parsed_styles['declarations'] = array_merge( $parsed_styles['declarations']static::get_css_declarations( $style_value$style_definition$options ) );
            }
        }

        return $parsed_styles;
    }

    /** * Returns classnames, and generates classname(s) from a CSS preset property pattern, * e.g. `var:preset|<PRESET_TYPE>|<PRESET_SLUG>`. * * @since 6.1.0 * * @param string $style_value A single raw style value or CSS preset property * from the `$block_styles` array. * @param array $style_definition A single style definition from BLOCK_STYLE_DEFINITIONS_METADATA. * @return string[] An array of CSS classnames, or empty array if there are none. */
Home | Imprint | This part of the site doesn't use cookies.