You are here

function theme_textformatter_formatter_text_comma_and in Text list formatter 6

Theme a textfield as a comma-separated list with an "and".

1 call to theme_textformatter_formatter_text_comma_and()
theme_textformatter_formatter_text_comma_and_period in ./textformatter.module
Theme a textfield as a comma-separated list with an "and" and period.
1 string reference to 'theme_textformatter_formatter_text_comma_and'
textformatter_theme in ./textformatter.module
Implementation of hook_theme().

File

./textformatter.module, line 104

Code

function theme_textformatter_formatter_text_comma_and($element) {
  $values = textformatter_formatter_get_element_values($element);
  $last = '';
  if (count($values) > 1) {
    $last = array_pop($values);
    $last = ' ' . t('and') . ' ' . $last;
  }
  $phrase = implode(', ', $values) . $last;
  return $phrase;
}