| Conditions | 5 |
| Paths | 4 |
| Total Lines | 24 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 5 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | public function expand($values) { |
||
| 19 | $return = array(); |
||
| 20 | if (!empty($this->fieldInfo['settings']['allowed_values_function'])) { |
||
| 21 | $cacheable = TRUE; |
||
| 22 | $callback = $this->fieldInfo['settings']['allowed_values_function']; |
||
| 23 | $allowed_values = call_user_func($callback, $this->fieldInfo, $this, $this->entityType, $this->entity, $cacheable); |
||
| 24 | } |
||
| 25 | else { |
||
| 26 | $allowed_values = array(); |
||
| 27 | $options = array_flip($this->fieldInfo['settings']['allowed_values']); |
||
| 28 | foreach ($values as $value) { |
||
| 29 | if (array_key_exists($value, $options)) { |
||
| 30 | $allowed_values[$value] = $options[$value]; |
||
| 31 | } |
||
| 32 | else { |
||
| 33 | $allowed_values[$value] = $value; |
||
| 34 | } |
||
| 35 | } |
||
| 36 | } |
||
| 37 | foreach ($values as $value) { |
||
| 38 | $return[$this->language][] = array('value' => $allowed_values[$value]); |
||
| 39 | } |
||
| 40 | return $return; |
||
| 41 | } |
||
| 42 | |||
| 44 |