| Server IP : 52.25.153.185 / Your IP : 216.73.217.131 Web Server : Apache System : Linux ip-172-26-6-158 5.10.0-35-cloud-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64 User : daemon ( 1) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /bitnami/wordpress/wp-content/plugins/fluentformpro/src/Components/ |
Upload File : |
<?php
namespace FluentFormPro\Components;
defined('ABSPATH') or die;
class CheckableOtherOption
{
/**
* Other option for checkbox and radio fields
*/
public static function boot()
{
// Add settings placement for form builder
add_filter('fluentform/editor_element_settings_placement', function ($placements) {
// Add settings for checkbox
if (isset($placements['input_checkbox']['general'])) {
$placements['input_checkbox']['general'][] = 'enable_other_option';
$placements['input_checkbox']['general'][] = 'other_option_label';
$placements['input_checkbox']['general'][] = 'other_option_placeholder';
}
// Add settings for radio
if (isset($placements['input_radio']['general'])) {
$placements['input_radio']['general'][] = 'enable_other_option';
$placements['input_radio']['general'][] = 'other_option_label';
$placements['input_radio']['general'][] = 'other_option_placeholder';
}
return $placements;
});
// Add default settings for existing forms upgrade - checkbox
add_filter('fluentform/editor_init_element_input_checkbox', function ($element) {
if (!isset($element['settings']['enable_other_option'])) {
$element['settings']['enable_other_option'] = 'no';
}
if (!isset($element['settings']['other_option_label'])) {
$element['settings']['other_option_label'] = __('Other', 'fluentformpro');
}
if (!isset($element['settings']['other_option_placeholder'])) {
$element['settings']['other_option_placeholder'] = __('Please specify...', 'fluentformpro');
}
return $element;
});
// Add default settings for existing forms upgrade - radio
add_filter('fluentform/editor_init_element_input_radio', function ($element) {
if (!isset($element['settings']['enable_other_option'])) {
$element['settings']['enable_other_option'] = 'no';
}
if (!isset($element['settings']['other_option_label'])) {
$element['settings']['other_option_label'] = __('Other', 'fluentformpro');
}
if (!isset($element['settings']['other_option_placeholder'])) {
$element['settings']['other_option_placeholder'] = __('Please specify...', 'fluentformpro');
}
return $element;
});
}
}