Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This hook allows you to change the values used in the graphs.
Usage
add_filter('frm_graph_value', 'my_custom_graph_value', 10, 2);
Parameters
- $value (mixed)
- $field (object)
Examples
Use typed signature
This is from the signature add-on to tell the graphs to use the typed signature instead of the written one.
add_filter('frm_graph_value', 'my_custom_graph_value', 10, 2);
function my_custom_graph_value( $value, $field ) {
if ( is_object( $field ) && $field->type == 'signature' ) {
if ( is_array( $value ) ) {
if ( ( ! isset( $value['output'] ) || empty( $value['output'] ) ) ) {
$value = isset( $value['typed'] ) ? $value['typed'] : reset( $value );
} else {
$value = '';
}
}
}
return $value;
}
Basic Example
Change a graph value.
add_filter('frm_graph_value', 'my_custom_graph_value', 10, 2);
function my_custom_graph_value( $value, $field ) {
if ( $field->id == 123 ) {
$value = 'new value';
}
return $value;
}