This hook can be used to alter the default value of a field when set by the Dynamic default value option.
quform_element_value_X
This hook is run for a parameter name.
Example
12
3
| add_filter('quform_element_value_my_parameter', function ($value, $key) { return 'Foo'; }, 10, 2); |
add_filter('quform_element_value_my_parameter', function ($value, $key) { return 'Foo'; }, 10, 2);
- On line 1, replace
my_parameter
with the value of the Parameter name option configured in the element settings
1
2
3
4
5 | function my_element_value($value, $key) { return 'Foo'; } add_filter('quform_element_value_my_parameter', 'my_element_value', 10, 2); |
function my_element_value($value, $key) { return 'Foo'; } add_filter('quform_element_value_my_parameter', 'my_element_value', 10, 2);
- On line 5, replace
my_parameter
with the value of the Parameter name option configured in the element settings
Parameters
$value
–mixed
– the current dynamic default value (data type depends on element type)$key
–string
– the value of the Parameter name option configured in the element settings
quform_element_value
This hook is run for all parameter names.
Example
1 2 3 4 5 6 7 | add_filter('quform_element_value', function ($value, $key) { if ($key == 'my_parameter') { $value = 'Foo'; } return $value; }, 10, 2); |
add_filter('quform_element_value', function ($value, $key) { if ($key == 'my_parameter') { $value = 'Foo'; } return $value; }, 10, 2);
1 2 3 4 5 6 7 8 9 | function my_element_value($value, $key) { if ($key == 'my_parameter') { $value = 'Foo'; } return $value; } add_filter('quform_element_value', 'my_element_value', 10, 2); |
function my_element_value($value, $key) { if ($key == 'my_parameter') { $value = 'Foo'; } return $value; } add_filter('quform_element_value', 'my_element_value', 10, 2);
Parameters
$value
–mixed
– the current dynamic default value (data type depends on element type)$key
–string
– the value of the Parameter name option configured in the element settings