Fields() function returns an object instead of an array
-
Dear,
First of all, thank you very much for this wonderfull plugin !
I would like to use standard array functions (array_keys(), …) over PODS fields.
Therefore I use the field() function, which says it returns an array:
https://docs.pods.io/code/pods/fields/
Unfortunatly, it returns an array of field objects.
Here is the output of a var_dump for the first field object:
object(Pods\Whatsit\Field)#11326 (1) { ["args"]=> array(29) { ["object_type"]=> string(5) "field" ...Therefore I can’t use php functions like array_keys() on this object.
I tried to convert it to an array by applying the array() function on it… but it only wraps the field object into an array of one element. The object remains an object and can not be passed to PHP array functions:
array(1) { [0]=> object(Pods\Whatsit\Field)#11326 (1) { ["args"]=> array(29) { ["object_type"]=> string(5) "field" ...I can ask the first element of this array and it gives me back the object, returning me to the previous step… 🙁
Is there any way to convert this object into an array and be able to use PHP standard array function on it ?
Thank you very much
Kind regards
Xerviami
The topic ‘Fields() function returns an object instead of an array’ is closed to new replies.