Ignore empty field values

Created on 3 July 2017, over 7 years ago
Updated 25 September 2023, about 1 year ago

Say you combined 5 fields, and for a given row only the 2nd and 3rd field have a value,
views_fields_combine_handler_field_combine::render() would generate $output something like:

array(
  0 => NULL,
  1 => 'sausage',
  2 => 'lemon',
  3 => NULL,
  4 => NULL,
);

With a separator of ", " this would return something like:
, sausage, lemon, ,

It would be a lot nicer if this displayed as:
sausage, lemon

This can be achieved by ignoring the empty values, something like this:
views_fields_combine_handler_field_combine.inc

  function render($values) {
    ...
-   return implode($separator, $output);
+   return implode($separator, array_filter($output));
  }

Needs work as a patch of the above needs to be rolled.

Feature request
Status

Closed: outdated

Version

1.2

Component

Code

Created by

🇬🇧United Kingdom mustanggb Coventry, United Kingdom

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024