I created custom views fields that calculate a percentage and number based on referencing nodes to current item. So of all 10 nodes 5 of them are referencing to this item.

So output will be 50%, I also have a field that output the numbers so 5/10.

These two fields have the same calculation so to make it more lean I want to try and output both values from one custom views field. It should be possible the link field can output title and url. Is there a way to do this with my custom field. So instead of two fields:


I want one field with two outputs:


At this moment I use the following in the render function:

return $percentage;


return $number;

I tried something like:

    $result = [
        'precentage' => $percentage,
        'number' => $number,
    return $result;

But the options I want don't show in the view replacement patterns. How can I do this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.