admin_form_before(); $output .= $this->admin_form_start(); $output .= $this->default_fields(); $widget_saved_values = $this->get_settings(); $output .= $this->admin_language_tab(); //have to start language tab from here on $output .= $this->admin_language_tab_start(); $all_languages = LanguageHelper::all_languages(); foreach ($all_languages as $key => $lang) { $output .= $this->admin_language_tab_content_start([ 'class' => $key == 0 ? 'tab-pane fade show active' : 'tab-pane fade', 'id' => "nav-home-" . $lang->slug ]); $output .= Text::get([ 'name' => 'title_'.$lang->slug, 'label' => __('Title'), 'value' => $widget_saved_values['title_' . $lang->slug] ?? null, ]); $output .= $this->admin_language_tab_content_end(); } $output .= $this->admin_language_tab_end(); //have to end language tab $output .= Text::get([ 'name' => 'location', 'label' => __('Location'), 'value' => $widget_saved_values['location'] ?? null, ]); $output .= Select::get([ 'name' => 'custom_form_id', 'label' => __('Custom Form'), 'placeholder' => __('Select form'), 'options' => FormBuilder::all()->pluck('title','id')->toArray(), 'value' => $widget_saved_values['custom_form_id'] ?? [] ]); $output .= Slider::get([ 'name' => 'padding_top', 'label' => __('Padding Top'), 'value' => $widget_saved_values['padding_top'] ?? 50, 'max' => 200, ]); $output .= Slider::get([ 'name' => 'padding_bottom', 'label' => __('Padding Bottom'), 'value' => $widget_saved_values['padding_bottom'] ?? 50, 'max' => 200, ]); $output .= $this->admin_form_submit_button(); $output .= $this->admin_form_end(); $output .= $this->admin_form_after(); return $output; } /** * frontend_render * this method must have to implement by all widget to render frontend widget content * @since 1.0.0 * */ public function frontend_render(): string { $all_settings = $this->get_settings(); $current_lang = LanguageHelper::user_lang_slug(); $location = SanitizeInput::esc_html($all_settings['location']); $location = sprintf( '
', rawurlencode($location), 10, $location ); $custom_form_id = SanitizeInput::esc_html($all_settings['custom_form_id']); $title = SanitizeInput::esc_html($all_settings['title_'.$current_lang]); $custom_form_markup = FormBuilderCustom::render_form($custom_form_id,null,null,'boxed-btn reverse-color','contact-page-form'); $padding_top = SanitizeInput::esc_html($all_settings['padding_top']); $padding_bottom = SanitizeInput::esc_html($all_settings['padding_bottom']); return <<

{$title}

{$custom_form_markup}
{$location}
HTML; } /** * widget_title * this method must have to implement by all widget to register widget title * @since 1.0.0 * */ public function addon_title() { return __('Contact Area: 04'); } }