Skip to main content
removed tags from title
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Drupal PHP in views - remove Remove duplicates from field [array]

added 14 characters in body
Source Link
Sam
  • 41
  • 3

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 arrayfield (array) above and remove duplicates?

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
                    )

How can I retrieve the values of the last array above and remove duplicates?

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?

added 83 characters in body
Source Link
Sam
  • 41
  • 3

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
                    )

How can I retrieve the values of the last array above and remove duplicates?

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
                    )

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
                    )

How can I retrieve the values of the last array above and remove duplicates?

Source Link
Sam
  • 41
  • 3
Loading