__( 'Add weForms Form to Sidebar', 'weforms' )] ); } /** * Render widget * * @return void */ public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', $instance['title'] ); $form_id = apply_filters( 'weforms_widget_form_id', $instance['form_id'] ); echo wp_kses_post( $args['before_widget'] ); if ( ! empty( $title ) ) { echo wp_kses_post( $args['before_title'] ) . wp_kses_post( $title ) . wp_kses_post( $args['after_title'] ); } echo do_shortcode( sprintf( '[weforms id ="%s" ]', $form_id ) ); echo wp_kses_post( $args['after_widget'] ); } /** * weForms widget backend * * @return void */ public function form( $instance ) { $title = isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : __( 'Form', 'weforms' ); $form_id = isset( $instance[ 'form_id' ] ) ? $instance[ 'form_id' ] : 0; $all_forms = weforms()->form->all(); $options = sprintf( "", 0, __( 'Select Form', 'weforms' ) ); foreach ( $all_forms['forms'] as $form ) { $options .= sprintf( "", $form->id, selected( $form_id, $form->id, false ), $form->name ); } ?>