__('A widget that promote you busincess video', 'sparklestore') )); } private function widget_fields() { $fields = array( 'sparklestore_promo_video' => array( 'sparklestore_widgets_name' => 'sparklestore_promo_video', 'sparklestore_widgets_title' => __('Enter Very Short Description', 'sparklestore'), 'sparklestore_widgets_field_type' => 'textarea', 'sparklestore_widgets_row' => 3, ), 'sparklestore_promo_video_url' => array( 'sparklestore_widgets_name' => 'sparklestore_promo_video_url', 'sparklestore_widgets_title' => __('Enter Youtube Video Url', 'sparklestore'), 'sparklestore_widgets_field_type' => 'url' ) ); return $fields; } public function widget($args, $instance) { extract($args); extract($instance); $desc = esc_textarea( $instance['sparklestore_promo_video'] ); $video_url = esc_url( $instance['sparklestore_promo_video_url'] ); echo $before_widget; ?>
widget_fields(); foreach ($widget_fields as $widget_field) { extract($widget_field); $instance[$sparklestore_widgets_name] = sparklestore_widgets_updated_field_value($widget_field, $new_instance[$sparklestore_widgets_name]); } return $instance; } public function form($instance) { $widget_fields = $this->widget_fields(); foreach ($widget_fields as $widget_field) { extract($widget_field); $sparklestore_widgets_field_value = !empty($instance[$sparklestore_widgets_name]) ? $instance[$sparklestore_widgets_name] : ''; sparklestore_widgets_show_widget_field($this, $widget_field, $sparklestore_widgets_field_value); } } }