init_constants(); } public function init_constants(){ $this->settings_fields = THFAQF_Utils::get_settings_fields(); $this->cell_props_L = array( 'label_cell_props' => 'width="20%"', 'input_cell_props' => 'width="27%"', 'input_width' => '250px', ); $this->cell_props_R = array( 'label_cell_props' => 'width="20%"', 'input_cell_props' => 'width="27%"', 'input_width' => '250px', ); $this->cell_props_CB = array( 'label_props' => 'style="margin-right: 40px;"', ); $this->cell_props_CBS = array( 'label_props' => 'style="margin-right: 15px;"', ); $this->cell_props_CBL = array( 'label_props' => 'style="margin-right: 52px;"', ); $this->cell_props_CPL = array( 'label_cell_props' => 'width="20%"', 'input_cell_props' => 'width="27%"', ); $this->cell_props_CPR = array( 'label_cell_props' => 'width="15%"', 'input_cell_props' => 'width="32%"', ); } public function render_form_field_element($field, $settings=array(), $atts=array(), $render_cell=true, $render_tooltip=true){ if($field && is_array($field)){ $ftype = isset($field['type']) ? $field['type'] : 'text'; $name = isset($field['name']) ? $field['name'] : ''; if(is_array($settings) && isset($settings[$name])){ if($ftype === 'checkbox' || $ftype === 'switch'){ if($settings[$name] === 'yes'){ $field['checked'] = 1; } }else{ $field['value'] = $settings[$name]; } } if($ftype == 'checkbox'){ $this->render_form_field_element_checkbox($name, $field, $atts, $render_cell); return true; } $args = shortcode_atts( array( 'label_cell_props' => '', 'input_cell_props' => '', 'label_cell_th' => false, 'input_width' => '', 'input_name_prefix' => '', 'input_name_suffix' => '' ), $atts ); $input_class = isset($field['class']) ? $field['class'] : array(); if($ftype == 'multiselect'){ $input_class[] = 'thpladmin-enhanced-multi-select'; $args['input_name_suffix'] = $args['input_name_suffix'].'[]'; }else if($ftype == 'colorpicker'){ $input_class[] = 'thpladmin-colorpicker'; } $fname = $args['input_name_prefix'].$name.$args['input_name_suffix']; $flabel = isset($field['label']) ? __($field['label'], 'advanced-faq-manager') : ''; $fvalue = isset($field['value']) ? $field['value'] : ''; $input_width = $args['input_width'] ? 'width:'.$args['input_width'].';' : ''; $field_props = 'name="'. $fname .'" value="'. $fvalue .'" style="'. $input_width .'"'; $field_props .= isset($field['placeholder']) && !empty($field['placeholder']) ? ' placeholder="'.$field['placeholder'].'"' : ''; $field_props .= is_array($input_class) && !empty($input_class) ? ' class="'.implode(" ", $input_class).'"' : ''; $required_html = isset($field['required']) && $field['required'] ? '*' : ''; $field_html = ''; if(isset($field['onchange']) && !empty($field['onchange'])){ $field_props .= ' onchange="'.$field['onchange'].'"'; } if($ftype == 'text'){ $field_html = ''; }else if($ftype == 'number'){ $field_html = ''; }else if($ftype == 'textarea'){ $field_html = ''; }else if($ftype == 'select'){ $field_html = ''; }else if($ftype == 'multiselect'){ $fvalue_arr = $fvalue ? explode(',', $fvalue) : array(); $field_html = ''; }else if($ftype == 'colorpicker'){ $prev_style = $fvalue ? 'background-color:'.$fvalue.';' : ''; $field_html = ''; $field_html .= ''; }else if($ftype == 'switch'){ $field_props .= isset($field['checked']) && $field['checked'] ? ' checked' : ''; $field_html .= ''; } if($render_cell){ $label_cell_props = !empty($args['label_cell_props']) ? ' '.$args['label_cell_props'] : ''; $input_cell_props = !empty($args['input_cell_props']) ? ' '.$args['input_cell_props'] : ''; ?> >
render_form_element_tooltip($tooltip); } ?> > '', 'input_props' => '', 'label_props' => '', 'name_prefix' => 'i_', 'id_prefix' => 'a_f' ), $atts ); $fid = $args['id_prefix'].$name; $fname = $args['name_prefix'].$name; $fvalue = isset($field['value']) ? $field['value'] : ''; $flabel = __($field['label'], 'advanced-faq-manager'); $field_props = 'id="'. $fid .'" name="'. $fname .'"'; $field_props .= !empty($fvalue) ? ' value="'. $fvalue .'"' : ''; $field_props .= isset($field['checked']) && $field['checked'] ? ' checked' : ''; $field_props .= $args['input_props']; $field_props .= isset($field['onchange']) && !empty($field['onchange']) ? ' onchange="'.$field['onchange'].'"' : ''; $field_html = ''; $field_html .= ''; if($render_cell){ ?> > '; } ?>   render_form_element_tooltip(false); ?>   array( 'type' => 'content', 'value' => 'Display Settings', 'class' => 'thfaq-settings-section-title', 'colspan' => '4', ), 'color_description' => array( 'type' => 'content', 'value' => 'Apply Display Color for FAQs. Colors can be also set for Individual FAQs at Corresponding FAQ.', 'colspan' => '4', ), 'title_color' => array( 'label' => __( 'Title Text Color', 'woocommerce'), 'class' => 'thpladmin-colorpicker', 'type' => 'color-picker', 'wrapper' => 'h5', 'value' => '#000000', ), 'title_bg_color' => array( 'label' => __( 'Title Background Color', 'woocommerce' ), 'class' => 'thpladmin-colorpicker', 'wrapper' => 'h5', 'type' => 'color-picker', 'value' => '#ccd0cc', ), 'content_color' => array( 'label' => __( 'Content Text Color', 'woocommerce' ), 'class' => 'thpladmin-colorpicker', 'wrapper' => 'h5', 'type' => 'color-picker', 'value' => '#000000', ), 'content_bg_color' => array( 'label' => __( 'Content Background Color', 'woocommerce' ), 'class' => 'thpladmin-colorpicker', 'wrapper' => 'h5', 'type' => 'color-picker', 'value' => '#ccd0cc', ), 'accordion_options' => array( 'type' => 'content', 'value' => 'Accordion Options', 'class' => 'thfaq-settings-section-title', 'colspan' => '4', ), 'accordion_display_style_on_load' => array( 'label' => __( 'Accordion Mode While Loading', 'woocommerce' ), 'wrapper' => 'h5', 'class' => '', 'type' => 'select', 'options' => array( 'open' => __( 'Open First FAQ', 'woocommerce' ), 'close' => __( 'Close All FAQs', 'woocommerce' ), ), 'value' => 'open', ), 'open_multiple_faqs' => array( 'label' => __( 'Keep Multiple FAQ Tab Open On Click.', 'woocommerce' ), 'type' => 'checkbox', 'wrapper' => 'h5', 'value' => '', ), 'show_updated_date' =>array( 'label' => __( 'Display Updated Date For FAQs.', 'woocommerce' ), 'type' => 'checkbox', 'wrapper' => 'h5', 'value' => '', ), 'social_share_settings' => array( 'type' => 'content', 'value' => 'Social Share Settings', 'class' => 'thfaq-settings-section-title', 'colspan' => '4', ), 'enable_share_button' =>array( 'label' => __( 'Enable Social Share Option for FAQs', 'woocommerce' ), 'type' => 'checkbox_enable_btn', 'wrapper' => 'h5', 'value' => '', 'colspan' => '4', ), 'share_button_title' => array( 'label' => __( 'Share Button Title', 'woocommerce' ), 'wrapper' => 'h5', 'class' => 'thfaq_disabled_label', 'type' => 'text', 'value' => '', ), 'social_share_options' =>array( 'label' => __( 'Add Share Buttons', 'woocommerce' ), 'wrapper' => 'h5', 'class' => '', 'type' => 'multiselect', 'options' => array( 'facebook' => __( 'Facebook', 'woocommerce' ), 'twitter' => __( 'Twitter', 'woocommerce' ), 'linkedin' => __( 'Linkedin', 'woocommerce' ), 'email' => __( 'Email', 'woocommerce' ), ), 'value' => '', ), 'faq_border_radius' => array( 'label' => __( 'FAQs Border Radius', 'woocommerce' ), 'wrapper' => 'h5', 'class' => 'thfaq-number-settings', 'type' => 'number', 'value' => 6, ), ); }*/ } endif;