class_id( $attributes ); $css->set_style_id( 'kb-' . $this->block_name . $unique_style_id ); $css->set_selector( '.wp-block-kadence-advanced-form .kb-field' . $class_id ); $css->render_responsive_range( $attributes, 'maxWidth', 'max-width', 'maxWidthUnit' ); $css->render_responsive_range( $attributes, 'minWidth', 'min-width', 'minWidthUnit' ); return $css->css_output(); } /** * Return dynamically generated HTML for block * * @param $attributes * @param $unique_id * @param $content * @param WP_Block $block_instance The instance of the WP_Block class that represents the block being rendered. * * @return mixed */ public function build_html( $attributes, $unique_id, $content, $block_instance ) { $is_required = $this->is_required( $attributes ); $class_id = $this->class_id( $attributes ); $outer_classes = [ 'kb-adv-form-field', 'kb-field' . $class_id ]; $wrapper_args = [ 'class' => implode( ' ', $outer_classes ), ]; $wrapper_attributes = get_block_wrapper_attributes( $wrapper_args ); $inner_content = ''; $check_label = $attributes; $check_label['inputName'] = 'cb' . $class_id; $inline_class = ''; if ( isset( $attributes['inline'] ) && true === $attributes['inline'] ) { $inline_class = ' kb-radio-check-items-inline'; } $inner_content .= '
additional_fieldset_attributes( $attributes ) . '>'; $inner_content .= $this->field_legend( $check_label ); $inner_content .= $this->field_aria_label( $attributes ); foreach ( $attributes['options'] as $key => $option ) { $id = 'field' . $class_id . '_' . $key; $option_value = $this->get_option_value( $option ); $is_checked_from_param = ! empty( $option_value ) && $option_value && in_array( $option_value, explode( ',', $this->get_default( $attributes ) ) ); $is_checked_from_editor = ! empty( $option['selected'] ); $is_checked = $is_checked_from_editor || $is_checked_from_param; $inner_content .= '
'; $inner_content .= 'aria_described_by( $attributes ) . ' id="' . esc_attr( $id ) . '" name="' . esc_attr( $this->field_name( $attributes ) ) . '[]"' . ( $is_checked ? ' checked' : '' ) . ' value="' . esc_attr( $option_value ) . '">'; $inner_content .= ''; $description = [ 'uniqueID' => $id, 'label' => ! empty( $attributes['description'] ) ? ' ' . $attributes['description'] : '', ]; $inner_content .= $this->field_label( $description ); $inner_content .= '
'; } $inner_content .= '
'; $inner_content .= $this->field_help_text( $attributes ); $content = sprintf( '
%2$s
', $wrapper_attributes, $inner_content ); return $content; } } Kadence_Blocks_Checkbox_Block::get_instance();