$attr ) { $type = is_array( $attr ) && isset( $attr['type'] ) && in_array( $attr['type'], self::TYPES, true ) ? $attr['type'] : 'string'; $def = is_array( $attr ) && isset( $attr['default'] ) ? $attr['default'] : ''; $normalized_attrs[ $k ] = array( 'type' => $type, 'default' => $def, ); } $block_meta = array( '$schema' => 'https://schemas.wp.org/trunk/block.json', 'apiVersion' => 3, 'name' => $block_slug, 'version' => '1.0.0', 'title' => $spec['title'], 'category' => $spec['category'] ?? 'widgets', 'icon' => $spec['icon'] ?? 'block-default', 'description' => $spec['description'] ?? '', 'attributes' => $normalized_attrs, 'supports' => array( 'html' => false, 'align' => true, 'color' => true, 'spacing' => true, ), 'render' => 'file:./render.php', ); $template = (string) ( $spec['template'] ?? '
{{content}}