everest-forms
/
addons
/
StyleCustomizer
/
includes
/
configs
/
evf-style-customizer-submission-message-configs.php
evf-style-customizer-color-palette.php
1 year ago
evf-style-customizer-form-wrapper-configs.php
1 year ago
evf-style-customizer-submission-message-configs.php
1 year ago
evf-style-customizer-submission-message-configs.php
292 lines
| 1 | <?php |
| 2 | /** |
| 3 | * EverestForms Info and Message Config Functions |
| 4 | * |
| 5 | * @package EverestForms_Style_Customizer/Functions |
| 6 | * @version 1.0.7 |
| 7 | */ |
| 8 | |
| 9 | defined( 'ABSPATH' ) || exit; |
| 10 | |
| 11 | /** |
| 12 | * Add everest forms Info and Message customizer sections. |
| 13 | * |
| 14 | * @param array $panels Array of panels. |
| 15 | */ |
| 16 | if ( defined( 'EFP_PLUGIN_FILE' ) ) { |
| 17 | function evf_style_customizer_submission_message_panels( $panels ) { |
| 18 | return array_merge( |
| 19 | $panels, |
| 20 | array( |
| 21 | 'everest_forms_submission_message' => array( |
| 22 | 'title' => esc_html__( 'Form Messages', 'everest-forms' ), |
| 23 | 'description' => esc_html__( 'This is field Submission message description.', 'everest-forms' ), |
| 24 | ), |
| 25 | ) |
| 26 | ); |
| 27 | } |
| 28 | |
| 29 | add_filter( 'everest_forms_style_customizer_panels', 'evf_style_customizer_submission_message_panels' ); |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Add everest forms Info and Message customizer sections. |
| 34 | * |
| 35 | * @param array $sections Array of sections. |
| 36 | */ |
| 37 | function evf_style_customizer_submission_message_sections( $sections ) { |
| 38 | return array_merge( |
| 39 | $sections, |
| 40 | array( |
| 41 | 'everest_forms_submission_success_message' => array( |
| 42 | 'title' => esc_html__( 'Success Message', 'everest-forms' ), |
| 43 | 'description' => esc_html__( 'This is field Submission message description.', 'everest-forms' ), |
| 44 | 'priority' => 10, |
| 45 | 'panel' => 'everest_forms_submission_message', |
| 46 | 'description_hidden' => true, |
| 47 | ), |
| 48 | 'everest_forms_submission_error_message' => array( |
| 49 | 'title' => esc_html__( 'Error Message', 'everest-forms' ), |
| 50 | 'description' => esc_html__( 'This is field Submission message description.', 'everest-forms' ), |
| 51 | 'priority' => 10, |
| 52 | 'panel' => 'everest_forms_submission_message', |
| 53 | 'description_hidden' => true, |
| 54 | ), |
| 55 | 'everest_forms_submission_info_message' => array( |
| 56 | 'title' => esc_html__( 'Info Message', 'everest-forms' ), |
| 57 | 'description' => esc_html__( 'This is field Submission message description.', 'everest-forms' ), |
| 58 | 'priority' => 10, |
| 59 | 'panel' => 'everest_forms_submission_message', |
| 60 | 'description_hidden' => true, |
| 61 | ), |
| 62 | 'everest_forms_submission_warning_message' => array( |
| 63 | 'title' => esc_html__( 'Warning Message', 'everest-forms' ), |
| 64 | 'description' => esc_html__( 'This is field Submission message description.', 'everest-forms' ), |
| 65 | 'priority' => 10, |
| 66 | 'panel' => 'everest_forms_submission_message', |
| 67 | 'description_hidden' => true, |
| 68 | ), |
| 69 | 'everest_forms_submission_validation_message' => array( |
| 70 | 'title' => esc_html__( 'Validation Message', 'everest-forms' ), |
| 71 | 'description' => esc_html__( 'This is field validation message description.', 'everest-forms' ), |
| 72 | 'priority' => 10, |
| 73 | 'panel' => 'everest_forms_submission_message', |
| 74 | 'description_hidden' => true, |
| 75 | ), |
| 76 | ) |
| 77 | ); |
| 78 | } |
| 79 | add_filter( 'everest_forms_style_customizer_sections', 'evf_style_customizer_submission_message_sections' ); |
| 80 | |
| 81 | /** |
| 82 | * Add everest forms style customizer controls. |
| 83 | * |
| 84 | * @param array $controls Array of controls. |
| 85 | */ |
| 86 | function evf_style_customizer_submission_message_controls( $controls ) { |
| 87 | $section_types = array( 'success_message', 'error_message', 'validation_message' ); |
| 88 | foreach ( $section_types as $section_name ) { |
| 89 | $controls[ $section_name ] = array( |
| 90 | 'show_submission_message' => array( |
| 91 | 'setting' => array( |
| 92 | 'default' => false, |
| 93 | ), |
| 94 | 'control' => array( |
| 95 | 'label' => esc_html__( 'Typography', 'everest-forms' ), |
| 96 | 'section' => 'everest_forms_submission_' . $section_name, |
| 97 | 'type' => 'EVF_Customize_Toggle_Control', |
| 98 | ), |
| 99 | ), |
| 100 | |
| 101 | 'font_size' => array( |
| 102 | 'setting' => array( |
| 103 | 'default' => '14', |
| 104 | 'sanitize_callback' => 'sanitize_text_field', |
| 105 | ), |
| 106 | 'control' => array( |
| 107 | 'label' => esc_html__( 'Font Size', 'everest-forms' ), |
| 108 | 'section' => 'everest_forms_submission_' . $section_name, |
| 109 | 'type' => 'EVF_Customize_Slider_Control', |
| 110 | 'input_attrs' => array( |
| 111 | 'min' => 1, |
| 112 | 'max' => 100, |
| 113 | 'step' => 1, |
| 114 | ), |
| 115 | ), |
| 116 | ), |
| 117 | 'font_style' => array( |
| 118 | 'setting' => array( |
| 119 | 'default' => array( |
| 120 | 'bold' => false, |
| 121 | 'italic' => false, |
| 122 | 'underline' => false, |
| 123 | 'uppercase' => false, |
| 124 | ), |
| 125 | ), |
| 126 | 'control' => array( |
| 127 | 'label' => esc_html__( 'Font Style', 'everest-forms' ), |
| 128 | 'section' => 'everest_forms_submission_' . $section_name, |
| 129 | 'type' => 'EVF_Customize_Image_Checkbox_Control', |
| 130 | 'choices' => array( |
| 131 | 'bold' => array( |
| 132 | 'name' => esc_html__( 'Bold', 'everest-forms' ), |
| 133 | 'image' => plugins_url( 'addons/StyleCustomizer/assets/images/bold.svg', EVF_PLUGIN_FILE ), |
| 134 | ), |
| 135 | 'italic' => array( |
| 136 | 'name' => esc_html__( 'Italic', 'everest-forms' ), |
| 137 | 'image' => plugins_url( 'addons/StyleCustomizer/assets/images/italic.svg', EVF_PLUGIN_FILE ), |
| 138 | ), |
| 139 | 'underline' => array( |
| 140 | 'name' => esc_html__( 'Underline', 'everest-forms' ), |
| 141 | 'image' => plugins_url( 'addons/StyleCustomizer/assets/images/underline.svg', EVF_PLUGIN_FILE ), |
| 142 | ), |
| 143 | 'uppercase' => array( |
| 144 | 'name' => esc_html__( 'Uppercase', 'everest-forms' ), |
| 145 | 'image' => plugins_url( 'addons/StyleCustomizer/assets/images/uppercase.svg', EVF_PLUGIN_FILE ), |
| 146 | ), |
| 147 | ), |
| 148 | ), |
| 149 | ), |
| 150 | 'text_alignment' => array( |
| 151 | 'setting' => array( |
| 152 | 'default' => 'left', |
| 153 | 'sanitize_callback' => 'sanitize_text_field', |
| 154 | ), |
| 155 | 'control' => array( |
| 156 | 'label' => esc_html__( 'Text Alignment', 'everest-forms' ), |
| 157 | 'section' => 'everest_forms_submission_' . $section_name, |
| 158 | 'type' => 'EVF_Customize_Image_Radio_Control', |
| 159 | 'choices' => array( |
| 160 | 'left' => array( |
| 161 | 'name' => esc_html__( 'Left', 'everest-forms' ), |
| 162 | 'image' => plugins_url( 'addons/StyleCustomizer/assets/images/align-left.svg', EVF_PLUGIN_FILE ), |
| 163 | ), |
| 164 | 'center' => array( |
| 165 | 'name' => esc_html__( 'Center', 'everest-forms' ), |
| 166 | 'image' => plugins_url( 'addons/StyleCustomizer/assets/images/align-center.svg', EVF_PLUGIN_FILE ), |
| 167 | ), |
| 168 | 'right' => array( |
| 169 | 'name' => esc_html__( 'Right', 'everest-forms' ), |
| 170 | 'image' => plugins_url( 'addons/StyleCustomizer/assets/images/align-right.svg', EVF_PLUGIN_FILE ), |
| 171 | ), |
| 172 | ), |
| 173 | ), |
| 174 | ), |
| 175 | 'font_color' => array( |
| 176 | 'setting' => array( |
| 177 | 'default' => '#fff', |
| 178 | ), |
| 179 | 'control' => array( |
| 180 | 'label' => esc_html__( 'Font Color', 'everest-forms' ), |
| 181 | 'section' => 'everest_forms_submission_' . $section_name, |
| 182 | 'type' => 'EVF_Customize_Color_Control', |
| 183 | ), |
| 184 | ), |
| 185 | 'background_color' => array( |
| 186 | 'setting' => array( |
| 187 | 'default' => '#fff', |
| 188 | 'sanitize_callback' => 'sanitize_text_field', |
| 189 | ), |
| 190 | 'control' => array( |
| 191 | 'label' => esc_html__( 'Background Color', 'everest-forms' ), |
| 192 | 'section' => 'everest_forms_submission_' . $section_name, |
| 193 | 'type' => 'EVF_Customize_Color_Control', |
| 194 | ), |
| 195 | ), |
| 196 | 'border_type' => array( |
| 197 | 'setting' => array( |
| 198 | 'default' => 'none', |
| 199 | 'sanitize_callback' => 'sanitize_text_field', |
| 200 | ), |
| 201 | 'control' => array( |
| 202 | 'type' => 'select', |
| 203 | 'label' => esc_html__( 'Border Type', 'everest-forms' ), |
| 204 | 'section' => 'everest_forms_submission_' . $section_name, |
| 205 | 'choices' => array( |
| 206 | 'none' => esc_html__( 'None', 'everest-forms' ), |
| 207 | 'hidden' => esc_html__( 'Hidden', 'everest-forms' ), |
| 208 | 'dotted' => esc_html__( 'Dotted', 'everest-forms' ), |
| 209 | 'dashed' => esc_html__( 'Dashed', 'everest-forms' ), |
| 210 | 'solid' => esc_html__( 'Solid', 'everest-forms' ), |
| 211 | 'double' => esc_html__( 'Double', 'everest-forms' ), |
| 212 | 'groove' => esc_html__( 'Groove', 'everest-forms' ), |
| 213 | 'ridge' => esc_html__( 'Ridge', 'everest-forms' ), |
| 214 | 'inset' => esc_html__( 'Inset', 'everest-forms' ), |
| 215 | 'outset' => esc_html__( 'Outset', 'everest-forms' ), |
| 216 | 'initial' => esc_html__( 'Initial', 'everest-forms' ), |
| 217 | 'inherit' => esc_html__( 'Inherit', 'everest-forms' ), |
| 218 | ), |
| 219 | ), |
| 220 | ), |
| 221 | 'border_width' => array( |
| 222 | 'setting' => array( |
| 223 | 'default' => array( |
| 224 | 'top' => 0, |
| 225 | 'right' => 0, |
| 226 | 'bottom' => 0, |
| 227 | 'left' => 0, |
| 228 | ), |
| 229 | ), |
| 230 | 'control' => array( |
| 231 | 'label' => esc_html__( 'Border Width', 'everest-forms' ), |
| 232 | 'section' => 'everest_forms_submission_' . $section_name, |
| 233 | 'type' => 'EVF_Customize_Dimension_Control', |
| 234 | 'input_attrs' => array( |
| 235 | 'min' => 0, |
| 236 | ), |
| 237 | 'custom_args' => array( |
| 238 | 'anchor' => true, |
| 239 | 'input_type' => 'number', |
| 240 | ), |
| 241 | ), |
| 242 | ), |
| 243 | 'border_color' => array( |
| 244 | 'setting' => array( |
| 245 | 'default' => '#cccccc', |
| 246 | 'sanitize_callback' => 'sanitize_text_field', |
| 247 | ), |
| 248 | 'control' => array( |
| 249 | 'label' => esc_html__( 'Border Color', 'everest-forms' ), |
| 250 | 'section' => 'everest_forms_submission_' . $section_name, |
| 251 | 'type' => 'EVF_Customize_Color_Control', |
| 252 | ), |
| 253 | ), |
| 254 | 'border_radius' => array( |
| 255 | 'setting' => array( |
| 256 | 'default' => array( |
| 257 | 'top' => 5, |
| 258 | 'right' => 5, |
| 259 | 'bottom' => 5, |
| 260 | 'left' => 5, |
| 261 | 'unit' => 'px', |
| 262 | ), |
| 263 | ), |
| 264 | 'control' => array( |
| 265 | 'label' => esc_html__( 'Border Radius', 'everest-forms' ), |
| 266 | 'section' => 'everest_forms_submission_' . $section_name, |
| 267 | 'type' => 'EVF_Customize_Dimension_Control', |
| 268 | 'input_attrs' => array( |
| 269 | 'min' => 0, |
| 270 | ), |
| 271 | 'custom_args' => array( |
| 272 | 'anchor' => true, |
| 273 | 'input_type' => 'number', |
| 274 | 'unit_choices' => array( |
| 275 | 'px' => esc_attr__( 'PX', 'everest-forms' ), |
| 276 | '%' => esc_attr__( '%', 'everest-forms' ), |
| 277 | ), |
| 278 | ), |
| 279 | ), |
| 280 | ), |
| 281 | ); |
| 282 | } |
| 283 | |
| 284 | // Set default font and background colors. |
| 285 | $controls['validation_message']['font_color']['setting']['default'] = '#fa5252'; |
| 286 | $controls['success_message']['background_color']['setting']['default'] = '#5cb85c'; |
| 287 | $controls['error_message']['background_color']['setting']['default'] = '#d9534f'; |
| 288 | |
| 289 | return $controls; |
| 290 | } |
| 291 | add_filter( 'everest_forms_style_customizer_controls', 'evf_style_customizer_submission_message_controls' ); |
| 292 |