Fix an issue where the block_field( 'className' ) doesn't output anything#353
Fix an issue where the block_field( 'className' ) doesn't output anything#353lukecarbis merged 1 commit intodevelopfrom
Conversation
…hing Rob found this issue. Reinstate the handling of className before.
| if ( 'autop' === $block_lab_config->fields[ $name ]->settings['new_lines'] ) { | ||
| $value = wpautop( $value ); | ||
| if ( isset( $block_lab_config->fields[ $name ]->type ) ) { | ||
| switch ( $block_lab_config->fields[ $name ]->type ) { |
There was a problem hiding this comment.
Since className isn't in $block_lab_config['fields'], this caused an error before.
| $value = wpautop( $value ); | ||
| if ( isset( $block_lab_config->fields[ $name ]->type ) ) { | ||
| switch ( $block_lab_config->fields[ $name ]->type ) { | ||
| case 'string': |
There was a problem hiding this comment.
The diff inside this switch block is whitespace-only, from indenting it inside the new conditional. You might want to check Hide whitespace changes
| ! isset( $block_lab_attributes ) || | ||
| ! is_array( $block_lab_attributes ) || | ||
| ! isset( $block_lab_config->fields[ $name ] ) | ||
| ( ! isset( $block_lab_config->fields[ $name ] ) && 'className' !== $name ) |
There was a problem hiding this comment.
className isn't normally in $block_lab_config->fields
|
Steps To Reproduce Thanks to @RobStino for finding this.
|
|
Request For Review Hi @lukecarbis and @RobStino, Though this looks to fix the issue for now, there might need to be more thought about It has a lot of special handling for Thanks! |
|
Also, I'm making it a priority to add more unit tests to the plugin. They might have prevented an issue like this. |
lukecarbis
left a comment
There was a problem hiding this comment.
Tested – everything here works great. :)
Fix an issue where the block_field( 'className' ) doesn't output anything
@RobStino found this issue, where
block_field( 'className' )has no output. Similarly,block_value( 'className' )didn't return anything.