[wp-trac] [WordPress Trac] #54386: SSR blocks with enum attribute thows notice

WordPress Trac noreply at wordpress.org
Sat Nov 6 13:14:36 UTC 2021


#54386: SSR blocks with enum attribute thows notice
--------------------------+-----------------------------
 Reporter:  walbo         |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Server side rendering a block that has a `enum` attribute without a `type`
 throws an notice that says `type` in undefined in the rest api.

 The rest api should require either a `type` or an `enum`.

 Ex on block that will fail:
 {{{#!php
 <?php
 register_block_type(
     'core/example',
     array(
         'attributes'      => array(
             'value'    => array(
                 'enum' => [ 'ok', false ],
             ),
         ),
         'render_callback' => function( $block_attributes ) {
             return $block_attributes['value'];
         },
     )
 );
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54386>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list