diff -u b/plugins/selection/EntityReference_SelectionHandler_Views.class.php b/plugins/selection/EntityReference_SelectionHandler_Views.class.php --- b/plugins/selection/EntityReference_SelectionHandler_Views.class.php +++ b/plugins/selection/EntityReference_SelectionHandler_Views.class.php @@ -149,17 +149,17 @@ public function validateAutocompleteInput($input, &$element, &$form_state, $form) { $bundled_entities = $this->getReferencableEntities($input, '=', 6); $entities = array(); - foreach($bundled_entities as $entities_list) { + foreach ($bundled_entities as $entities_list) { $entities += $entities_list; } if (empty($entities)) { // Error if there are no entities available for a required field. - form_error($element, t('There are no entities matching "%value"', array('%value' => $input))); + form_error($element, t('There are no entities matching %label', array('%label' => $element['#title']))); } elseif (count($entities) > 5) { // Error if there are more than 5 matching entities. - form_error($element, t('Many entities are called %value. Specify the one you want by appending the id in parentheses, like "@value (@id)"', array( - '%value' => $input, + form_error($element, t('Many entities are called for %label. Specify the one you want by appending the id in parentheses, like "@value (@id)"', array( + '%label' => filter_xss($element['#title']), '@value' => $input, '@id' => key($entities), ))); @@ -168,9 +168,12 @@ // More helpful error if there are only a few matching entities. $multiples = array(); foreach ($entities as $id => $name) { - $multiples[] = $name . ' (' . $id . ')'; + $multiples[] = filter_xss($name) . ' (' . $id . ')'; } - form_error($element, t('Multiple entities match this reference; "%multiple"', array('%multiple' => implode('", "', $multiples)))); + form_error($element, t('Multiple entities match %label": !multiple', array( + '%label' => $element['#title'], + '!multiple' => theme('item_list', array('items' => $multiples)), + ))); } else { // Take the one and only matching entity.