You are here

function textformatter_formatter_get_element_values in Text list formatter 6

Return an array of the values from a text field element.

4 calls to textformatter_formatter_get_element_values()
theme_textformatter_formatter_text_comma in ./textformatter.module
Theme a textfield as a comma-separated list.
theme_textformatter_formatter_text_comma_and in ./textformatter.module
Theme a textfield as a comma-separated list with an "and".
theme_textformatter_formatter_text_orderedlist in ./textformatter.module
Theme a textfield as an HTML ordered list.
theme_textformatter_formatter_text_unorderedlist in ./textformatter.module
Theme a textfield as an HTML unordered list.

File

./textformatter.module, line 65

Code

function textformatter_formatter_get_element_values($element) {

  // Get data out of multidimensional $element array and place it in flat $values array.
  $values = array();
  $item = $element;
  foreach (element_children($element) as $key) {
    unset($item[$key]);
  }
  foreach (element_children($element) as $key) {
    $item['#item'] = $element[$key]['#item'];
    $values[] = ($allowed = _text_allowed_values($item)) ? $allowed : $item['#item']['safe'];
  }

  // Trim values in the array.
  $values = array_map('trim', $values);

  // Kill empty values in the array.
  $values = array_filter($values);
  return $values;
}