Give the gift of Drupal. All merchandise is 50% off through 2016.
For my node titles, I often want to concatenate several fields, using a space as the 'glue' character. If one of the fields is empty, I do not want a leading space, trailing space, or double space in the result. I also want to ensure that a default is used if none of the fields have any content.
Below is an example of some code. Might it be possible to integrate this functionality into the module somehow, so the same result could be achieved using (just) token placeholders rather PHP code?
$default_title = '[name not known]'; $title_pieces = array(); $title_pieces = "[node:field_person_name_given]"; $title_pieces = "[node:field_person_name_middle]"; $title_pieces = "[node:field_person_name_surname]"; $title = implode(' ', array_filter($title_pieces)); return ($title) ? ($title) : ($default_title);
Sorry if this is out of scope, and thanks very much for your work on a great module.