The value of a Pods field annotated in magic tags can be ran through helper functions by separating the field name and helper function with a comma, like {@my_field_name,pll_e}
—?as long as `function pll_e() takes only one mandatory argument, which is the value of the field.
To use this feature, see Pods Admin > Settings
under labels Display callbacks
and Display callbacks allowed
— one would need pll_e
to be in the comma-separated list of allowed function names for it to be used in this way.
If another function is desired in the future, but it requires more than one argument, one can write a wrapping function for display purposes, for example:
<?php
function display_callback_name( $field_value ) {
return another_function( $field_value, 123, 'abc', [ 'some', 'values' ] );
}
…would allow {@my_field_name,display_callback_name}
to display a calculated value, such as a translation, by passing the $field_value
of my_field_name
to a function named another_function
with some default additional arguments of integer 123
, text 'abc'
and array/list [ 'some', 'values' ]
.