1

I am using php in views and trying to make a custom field to remove the duplicates in [field_trucks_notification_no_ref_node_eb:field_trucks_agency] field, i tried to use the row->field_name from the available variables in Global:PHP (output) with no luck.

 stdClass Object
    (
        [entity] => 268
        [_entity_properties] => Array
            (
                [search_api_relevance] => 1
                [search_api_excerpt] => 
                [search_api_id] => 268
                [field_cons_country_border] => 35604
                [field_trucks_notification_no_ref_node_eb] => Array
                    (
                        [0] => 269
                        [1] => 272
                        [2] => 278
                    )

                [field_trucks_notification_no_ref_node_eb:field_trucks_agency] => Array
                    (
                        [0] => 35617
                        [1] => 35621
                        [2] => 35617
                    )

EDIT: using Global:PHP field in views, How can I retrieve the values of the last field (array) above and remove duplicates?

1 Answer 1

0

To remove duplicates in Views, if the views advanced settings "Distinct" don't operate, have a look at Views Distinct module: https://www.drupal.org/project/views_distinct. Really useful project and sounds better than php in views.

4
  • Sorry for bad answer formatting, I'm writing from phone ...
    – Kojo
    Commented Nov 21, 2015 at 23:18
  • Thanks for the answer, I tried using it with no luck that's why I'm looking to make it in php. Because the field values (taxonomy terms) are already aggregated together via Search API and entity backreference
    – Sam
    Commented Nov 21, 2015 at 23:25
  • So consider editing your question and be more precise with the context, and what you tried so far to solve your issue. ;)
    – Kojo
    Commented Nov 21, 2015 at 23:35
  • question edited :)
    – Sam
    Commented Nov 22, 2015 at 5:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.