prefix . $this->lp_widget_id; $name = $this->lp_widget_name; $widget_options = array_merge( [ 'description' => $this->lp_widget_description, 'classname' => $this->lp_widget_class, 'customize_selective_refresh' => true, ], $this->lp_widget_options ); $control_options = $this->control_options; parent::__construct( $id_base, $name, $widget_options, $control_options ); } public function form( $instance ) { if ( empty( $this->lp_widget_setting ) ) { echo '
' . esc_html__( 'There are no options for this widget.', 'learnpress' ) . '
'; return; } foreach ( $this->lp_widget_setting as $key => $setting ) { $extra = $setting; $extra['value'] = $instance[ $key ] ?? ''; $extra['default'] = $setting['std'] ?? ''; $extra['id'] = $this->get_field_id( $key ); if ( isset( $setting['type'] ) && LPMetaBoxField::CHECKBOX === $setting['type'] ) { $html_wrapper = [ '' => '
', '' => '', ]; } else { $html_wrapper = [ '' => '
', '' => '', ]; } LPMetaBoxField::render( $setting['type'], $this->get_field_name( $key ), $extra, $html_wrapper ); } } }