', $this->get_field_id( 'title' ), esc_html__( 'Title', 'ac-repair' ), $this->get_field_name( 'title' ), esc_attr( $title ) ); $variable_list = fixit_function_font_awesome_icon_list(); $font_key = $font_value = $option_key = ''; $fontawesome = isset( $instance['fontawesome'] ) ? $instance['fontawesome'] : ''; $fontawesome = esc_html( $fontawesome ); foreach ($variable_list as $key => $value) { $font_key .= $key; $font_value .= $value; $option_key .= ''; } printf( '


', $this->get_field_id( 'fontawesome' ), esc_html__('Choose your icon', 'ac-repair' ), $this->get_field_name( 'fontawesome' ), $option_key ); $textarea = isset ( $instance['textarea'] ) ? $instance['textarea'] : esc_html__('Fixit -- Sidebar Your Descrition.', 'ac-repair' ); $textarea = esc_attr( $textarea ); printf( '


', $this->get_field_id( 'textarea' ), esc_html__( 'Description', 'ac-repair' ), $this->get_field_name( 'textarea' ), esc_attr( $textarea ) ); } /** * Renders the output. * * @see WP_Widget::widget() */ public function widget( $args, $instance ){ // Widget output extract($args); $fontawesome = isset( $instance['fontawesome'] ) ? $instance['fontawesome'] : ''; $title = isset( $instance['title'] ) ? $instance['title'] : esc_html__('Fixit -- Sidebar Title', 'ac-repair'); $textarea = isset( $instance['textarea'] ) ? $instance['textarea'] : esc_html__('Fixit -- your description.', 'ac-repair'); $selected_icon = isset( $fontawesome ) ? '' : ''; $fontawesome = esc_html( $fontawesome ); print $before_widget . '

'.$selected_icon . $before_title . esc_html( $title ) . $after_title . fixit_function_strip_tags( $textarea ) . '
' . $after_widget ; } /** * Prepares the content. Not. * * @param array $new_instance New content * @param array $old_instance Old content * @return array New content */ public function update( $new_instance, $old_instance ){ $new_instance_array = array( 'title', 'fontawesome', 'textarea' ); foreach( $new_instance_array as $val ) $old_instance[ $val ] = $new_instance[ $val ]; return $old_instance; } /** * Tell WP we want to use this widget. * * @wp-hook widgets_init * @return void */ public static function register(){ register_widget( __CLASS__ ); } }