Created custom view fields that calculate a percentage and a number according to the nodes of reference to the current element. So of the 10 nodes, 5 of them refer to this element.
So the output will be 50%, I also have a field that outputs the 5/10 numbers.
These two fields have the same calculation, so to make it leaner, I want to test and generate both values from a custom view field. There is some way to do this. So instead of two fields:
I want a field with two outputs:
At this time I use the following in the
returns $ percentage;
returns $ number;
I tried something like:
$ result = [ 'precentage' => $percentage, 'number' => $number, ]; returns $ result;
But the options I want are not shown in the view replacement patterns. How can I do this?