diff --git a/core/modules/options/lib/Drupal/options/Plugin/field/field_type/ListItemBase.php b/core/modules/options/lib/Drupal/options/Plugin/field/field_type/ListItemBase.php index bfe126c..3d116a6 100644 --- a/core/modules/options/lib/Drupal/options/Plugin/field/field_type/ListItemBase.php +++ b/core/modules/options/lib/Drupal/options/Plugin/field/field_type/ListItemBase.php @@ -136,7 +136,7 @@ public function validateAllowedValues($element, &$form_state) { // Prevent removing values currently in use. if ($has_data) { - $lost_keys = array_diff(array_keys($field['settings']['allowed_values']), array_keys($values)); + $lost_keys = array_diff(array_keys($field->getFieldSetting('allowed_values')), array_keys($values)); if (_options_values_in_use($field, $lost_keys)) { form_error($element, t('Allowed values list: some values are being removed while currently in use.')); } @@ -246,8 +246,8 @@ public function getConstraints() { 'value' => array( 'Choice' => array( 'choices' => array_keys($allowed_values), - 'message' => t('%name: illegal value.', array('%name' => $instance['label'])), - 'multiple' => $instance->getFieldCardinality() == FIELD_CARDINALITY_UNLIMITED, + 'message' => t('%name: illegal value selected.', array('%name' => $instance['label'])), + 'multiple' => $instance->getFieldCardinality() != 1, ), ), ));