Reputation: 5098
I am working with a wordpress plugin Gravity Forms.
The parameter $value
var_dump
result using gform_field_validation
filter returns is this...
string(4) "2434"
string(8) "Fantasma"
string(8) "fantasma"
string(13) "buzzlightyear"
array(1) {
["11.1"]=>
string(0) ""
}
array(1) {
["15.1"]=>
string(1) "1"
}
string(2) "10"
I'm trying to capture the first string(4) "2434"
but I have no idea how to target this.
Is there some php magic that can allow me to target this first string?
I know it's utter filth but Gravity Forms has left me choice to get this integer using their gform_field_validation filter.
Any ideas or thoughts would be much appreciated.
Upvotes: 0
Views: 57
Reputation: 1366
I think you will find that your output is the gform_field_validation
being looped over all of the inputs.
If you are wanting to get the $value
for a given field you will need to check the $field
object to match what you are after such as this:
add_filter('gform_field_validation', function($result, $value, $form, $field) {
if ($field->name == 'postcode') {
return $value;
}
});
This will then return the $value
for the input named 'postcode' for example
Upvotes: 1