| Conditions | 6 |
| Paths | 16 |
| Total Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | public function expand($values) { |
||
| 14 | $return = []; |
||
| 15 | $allowed_values = []; |
||
| 16 | if (!empty($this->fieldInfo['settings']['allowed_values_function'])) { |
||
| 17 | $cacheable = TRUE; |
||
| 18 | $callback = $this->fieldInfo['settings']['allowed_values_function']; |
||
| 19 | $options = call_user_func($callback, $this->fieldInfo, $this, $this->entityType, $this->entity, $cacheable); |
||
| 20 | } |
||
| 21 | else { |
||
| 22 | $options = $this->fieldInfo['settings']['allowed_values']; |
||
| 23 | } |
||
| 24 | foreach ($values as $value) { |
||
| 25 | if (array_key_exists($value, $options)) { |
||
| 26 | $allowed_values[$value] = $value; |
||
| 27 | } |
||
| 28 | elseif (in_array($value, $options)) { |
||
| 29 | $key = array_search($value, $options); |
||
| 30 | $allowed_values[$value] = $key; |
||
| 31 | } |
||
| 32 | } |
||
| 33 | foreach ($values as $value) { |
||
| 34 | $return[$this->language][] = ['value' => $allowed_values[$value]]; |
||
| 35 | } |
||
| 36 | return $return; |
||
| 37 | } |
||
| 38 | |||
| 40 |