You are here

function _composed_field_serialize in Composed Field 7

Returns an array of allowed values for a list field.

Parameters

String $value: The piped pair list of allowed values.

Return value

String The array of allowed values. Keys of the array are the raw stored values (number or text), values of the array are the display labels.

File

./composed_field.module, line 521
Defines composed field type.

Code

function _composed_field_serialize($value) {

  // Break the lines.
  $array = explode("\n", $value);

  // Break the pipes.
  foreach ($array as $key => $line) {
    unset($array[$key]);
    if (!empty($line)) {
      $line = explode("|", $line);
      $array[check_plain($line[0])] = check_plain($line[1]);
    }
  }
  return $array;
}