diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php index dbcb993..13025de 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php @@ -43,7 +43,7 @@ class TaxonomyTermReferenceItem extends ConfigEntityReferenceItemBase implements public function getPossibleValues(AccountInterface $account = NULL) { // Flatten options firstly, because Possible Options may contain group // arrays. - $flatten_options = $this->flattenOptions($this->getPossibleOptions($account)); + $flatten_options = \Drupal::formBuilder()->flattenOptions($this->getPossibleOptions($account)); return array_keys($flatten_options); } @@ -60,7 +60,7 @@ public function getPossibleOptions(AccountInterface $account = NULL) { public function getSettableValues(AccountInterface $account = NULL) { // Flatten options firstly, because Settable Options may contain group // arrays. - $flatten_options = $this->flattenOptions($this->getSettableOptions($account)); + $flatten_options = \Drupal::formBuilder()->flattenOptions($this->getSettableOptions($account)); return array_keys($flatten_options); } @@ -157,23 +157,4 @@ public function instanceSettingsForm(array $form, array &$form_state) { return array(); } - /** - * Flattens an array of allowed values. - * - * @todo Define this function somewhere else, so we don't have to redefine it - * when other field type classes, e.g. list option, need it too. - * https://drupal.org/node/2138803 - * - * @param array $array - * A single or multidimensional array. - * - * @return array - * The flattened array. - */ - protected function flattenOptions(array $array) { - $result = array(); - array_walk_recursive($array, function($a, $b) use (&$result) { $result[$b] = $a; }); - return $result; - } - }