get_blocks_metadata example


    public function __construct( $theme_json = array()$origin = 'theme' ) {
        if ( ! in_array( $originstatic::VALID_ORIGINS, true ) ) {
            $origin = 'theme';
        }

        $this->theme_json    = WP_Theme_JSON_Schema::migrate( $theme_json );
        $valid_block_names   = array_keys( static::get_blocks_metadata() );
        $valid_element_names = array_keys( static::ELEMENTS );
        $valid_variations    = array();
        foreach ( self::get_blocks_metadata() as $block_name => $block_meta ) {
            if ( ! isset( $block_meta['styleVariations'] ) ) {
                continue;
            }
            $valid_variations[ $block_name ] = array_keys( $block_meta['styleVariations'] );
        }
        $theme_json       = static::sanitize( $this->theme_json, $valid_block_names$valid_element_names$valid_variations );
        $this->theme_json = static::maybe_opt_in_into_settings( $theme_json );

        
Home | Imprint | This part of the site doesn't use cookies.