array( $this, 'block_render' ), 'attributes' => GhostKit_Form_Field_Attributes::get_block_attributes( array( 'label' => array( 'default' => esc_html__( 'Name', 'ghostkit' ), ), 'nameFields' => array( 'type' => 'string', 'default' => 'first', ), 'descriptionLast' => array( 'type' => 'string', ), 'placeholderLast' => array( 'type' => 'string', ), 'defaultLast' => array( 'type' => 'string', ), 'descriptionMiddle' => array( 'type' => 'string', ), 'placeholderMiddle' => array( 'type' => 'string', ), 'defaultMiddle' => array( 'type' => 'string', ), ) ), ) ); } /** * Register gutenberg block output * * @param array $attributes - block attributes. * * @return string */ public function block_render( $attributes ) { $attributes = array_merge( array( 'slug' => '', 'nameFields' => 'first', 'description' => '', 'descriptionLast' => '', 'placeholderLast' => '', 'defaultLast' => '', 'descriptionMiddle' => '', 'placeholderMiddle' => '', 'defaultMiddle' => '', 'hideDescription' => false, ), $attributes ); ob_start(); $class = 'ghostkit-form-field ghostkit-form-field-name'; if ( 'first-middle-last' === $attributes['nameFields'] || 'first-last' === $attributes['nameFields'] ) { $class .= ' ghostkit-form-field-name-with-last'; } if ( 'first-middle-last' === $attributes['nameFields'] ) { $class .= ' ghostkit-form-field-name-with-middle'; } if ( isset( $attributes['className'] ) ) { $class .= ' ' . $attributes['className']; } $last_attributes = array( 'slug' => $attributes['slug'], 'slug_sub' => 'last', 'description' => $attributes['descriptionLast'], 'placeholder' => $attributes['placeholderLast'], 'default' => $attributes['defaultLast'], 'hideDescription' => $attributes['hideDescription'], ); $middle_attributes = array( 'slug' => $attributes['slug'], 'slug_sub' => 'middle', 'description' => $attributes['descriptionMiddle'], 'placeholder' => $attributes['placeholderMiddle'], 'default' => $attributes['defaultMiddle'], 'hideDescription' => $attributes['hideDescription'], ); ?>