Description #
This filter is called before initializing each input element in the form editor page. Using this filter you can modify the input item settings data.
apply_filters('fluentform/editor_init_element_' . $formField['element'], $formField, $form);
Usage #
add_filter('fluentform/editor_init_element_container', function ($item, $form) {
if (!isset($item['settings']['container_class'])) {
$item['settings']['container_class'] = '';
}
return $item;
}, 10, 2);
add_filter('fluentform/editor_init_element_input_text', function ($element, $form) {
if (!isset($element['attributes']['maxlength'])) {
$element['attributes']['maxlength'] = '';
}
return $element;
}, 10, 2);
add_filter('fluentform/editor_init_element_input_number', function ($item, $form) {
if (!isset($item['settings']['number_step'])) {
$item['settings']['number_step'] = '';
}
if (!isset($item['settings']['numeric_formatter'])) {
$item['settings']['numeric_formatter'] = '';
}
if (!isset($item['settings']['prefix_label'])) {
$item['settings']['prefix_label'] = '';
}
if (!isset($item['settings']['suffix_label'])) {
$item['settings']['suffix_label'] = '';
}
return $item;
}, 10, 2);
Parameters #
- $formField (array) Form Field
- $form (object) Form Object
Placement #
This code should be placed in the functions.php file of your active theme.
Source Code #
This filter is located in FluentForm\App\Modules\Registerer\Menu -> enqueueEditorAssets()