Change the module name to entity_reference and fix the default field settings.
authorAndrei Mateescu
Tue, 30 Oct 2012 17:39:10 +0000 (18:39 +0100)
committerAndrei Mateescu
Tue, 30 Oct 2012 17:39:10 +0000 (18:39 +0100)
32 files changed:
core/modules/field/modules/entity_reference/css/entity_reference-rtl.admin.css [new file with mode: 0644]
core/modules/field/modules/entity_reference/css/entity_reference.admin.css [moved from core/modules/field/modules/entityreference/css/entityreference.admin.css with 54% similarity]
core/modules/field/modules/entity_reference/entity_reference.info [moved from core/modules/field/modules/entityreference/entityreference.info with 100% similarity]
core/modules/field/modules/entity_reference/entity_reference.install [moved from core/modules/field/modules/entityreference/entityreference.install with 94% similarity]
core/modules/field/modules/entity_reference/entity_reference.module [moved from core/modules/field/modules/entityreference/entityreference.module with 67% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceRecursiveRenderingException.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/EntityReferenceRecursiveRenderingException.php with 62% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/EntityreferenceBundle.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/EntityreferenceBundle.php with 61% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Derivative/SelectionBase.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/Derivative/SelectionBase.php with 91% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/Selection/SelectionBroken.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/Type/Selection/SelectionBroken.php with 91% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/Selection/SelectionInterface.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/Type/Selection/SelectionInterface.php with 88% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/SelectionPluginManager.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/Type/SelectionPluginManager.php with 89% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/Comment.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/entityreference/selection/Comment.php with 89% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/File.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/entityreference/selection/File.php with 79% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/Node.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/entityreference/selection/Node.php with 81% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/entityreference/selection/SelectionBase.php with 92% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/Term.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/entityreference/selection/Term.php with 91% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/User.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/entityreference/selection/User.php with 91% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceEntityFormatter.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/field/formatter/EntityReferenceEntityFormatter.php with 83% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceFormatterBase.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/field/formatter/EntityReferenceFormatterBase.php with 89% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceIdFormatter.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/field/formatter/EntityReferenceIdFormatter.php with 62% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceLabelFormatter.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/field/formatter/EntityReferenceLabelFormatter.php with 81% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteTagsWidget.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/field/widget/AutocompleteTagsWidget.php with 72% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidget.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/field/widget/AutocompleteWidget.php with 73% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/field/widget/AutocompleteWidgetBase.php with 94% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/views/display/EntityReference.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/views/display/Entityreference.php with 89% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/views/row/EntityReference.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/views/row/Entityreference.php with 85% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Plugin/views/style/EntityReference.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Plugin/views/style/Entityreference.php with 84% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAdminTest.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Tests/EntityReferenceAdminTest.php with 93% similarity]
core/modules/field/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php [moved from core/modules/field/modules/entityreference/lib/Drupal/entityreference/Tests/EntityReferenceSelectionAccessTest.php with 97% similarity]
core/modules/field/modules/entityreference/css/entityreference-rtl.admin.css [deleted file]
core/modules/field/modules/options/options.module
core/modules/views/lib/Drupal/views/Plugin/entity_reference/selection/Views.php [moved from core/modules/views/lib/Drupal/views/Plugin/entityreference/selection/Views.php with 84% similarity]

diff --git a/core/modules/field/modules/entity_reference/css/entity_reference-rtl.admin.css b/core/modules/field/modules/entity_reference/css/entity_reference-rtl.admin.css
new file mode 100644 (file)
index 0000000..3302ab8
--- /dev/null
@@ -0,0 +1,4 @@
+
+.entity_reference-settings {
+  margin-right: 1.5em;
+}
@@ -9,7 +9,7 @@
 /**
  * Implements hook_field_schema().
  */
-function entityreference_field_schema($field) {
+function entity_reference_field_schema($field) {
   $schema = array(
     'columns' => array(
       'target_id' => array(
@@ -13,21 +13,21 @@ use Drupal\Core\Entity\EntityInterface;
 /**
  * Implements hook_field_info().
  */
-function entityreference_field_info() {
-  $field_info['entityreference'] = array(
+function entity_reference_field_info() {
+  $field_info['entity_reference'] = array(
     'label' => t('Entity Reference'),
     'description' => t('This field reference another entity.'),
     'settings' => array(
-      // Default to the core target entity type node.
-      'target_type' => 'node',
+      // Default to a primary entity type (i.e. node or user).
+      'target_type' => module_exists('node') ? 'node' : 'user',
       // The handler for this field.
       'handler' => 'base',
       // The handler settings.
       'handler_settings' => array(),
     ),
     'instance_settings' => array(),
-    'default_widget' => 'options_list',
-    'default_formatter' => 'entityreference_label',
+    'default_widget' => 'entity_reference_autocomplete',
+    'default_formatter' => 'entity_reference_label',
   );
   return $field_info;
 }
@@ -35,22 +35,22 @@ function entityreference_field_info() {
 /**
  * Implements hook_menu().
  */
-function entityreference_menu() {
+function entity_reference_menu() {
   $items = array();
 
-  $items['entityreference/autocomplete/single/%/%/%'] = array(
+  $items['entity_reference/autocomplete/single/%/%/%'] = array(
     'title' => 'Entity Reference Autocomplete',
-    'page callback' => 'entityreference_autocomplete_callback',
+    'page callback' => 'entity_reference_autocomplete_callback',
     'page arguments' => array(2, 3, 4, 5),
-    'access callback' => 'entityreference_autocomplete_access_callback',
+    'access callback' => 'entity_reference_autocomplete_access_callback',
     'access arguments' => array(2, 3, 4, 5),
     'type' => MENU_CALLBACK,
   );
-  $items['entityreference/autocomplete/tags/%/%/%'] = array(
+  $items['entity_reference/autocomplete/tags/%/%/%'] = array(
     'title' => 'Entity Reference Autocomplete',
-    'page callback' => 'entityreference_autocomplete_callback',
+    'page callback' => 'entity_reference_autocomplete_callback',
     'page arguments' => array(2, 3, 4, 5),
-    'access callback' => 'entityreference_autocomplete_access_callback',
+    'access callback' => 'entity_reference_autocomplete_access_callback',
     'access arguments' => array(2, 3, 4, 5),
     'type' => MENU_CALLBACK,
   );
@@ -61,41 +61,41 @@ function entityreference_menu() {
 /**
  * Implements hook_field_is_empty().
  */
-function entityreference_field_is_empty($item, $field) {
+function entity_reference_field_is_empty($item, $field) {
   return !isset($item['target_id']) || !is_numeric($item['target_id']);
 }
 
 /**
- * Gets the selection handler for a given entityreference field.
+ * Gets the selection handler for a given entity_reference field.
  */
-function entityreference_get_selection_handler($field, $instance = NULL, EntityInterface $entity = NULL) {
+function entity_reference_get_selection_handler($field, $instance = NULL, EntityInterface $entity = NULL) {
   $options = array(
     'field' => $field,
     'instance' => $instance,
     'entity' => $entity,
   );
-  return drupal_container()->get('plugin.manager.entityreference.selection')->getInstance($options);
+  return drupal_container()->get('plugin.manager.entity_reference.selection')->getInstance($options);
 }
 
 /**
  * Implements hook_field_validate().
  */
-function entityreference_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) {
+function entity_reference_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) {
   $ids = array();
   foreach ($items as $delta => $item) {
-    if (!entityreference_field_is_empty($item, $field) && $item['target_id'] !== NULL) {
+    if (!entity_reference_field_is_empty($item, $field) && $item['target_id'] !== NULL) {
       $ids[$item['target_id']] = $delta;
     }
   }
 
   if ($ids) {
-    $valid_ids = entityreference_get_selection_handler($field, $instance, $entity)->validateReferencableEntities(array_keys($ids));
+    $valid_ids = entity_reference_get_selection_handler($field, $instance, $entity)->validateReferencableEntities(array_keys($ids));
 
     $invalid_entities = array_diff_key($ids, array_flip($valid_ids));
     if ($invalid_entities) {
       foreach ($invalid_entities as $id => $delta) {
         $errors[$field['field_name']][$langcode][$delta][] = array(
-          'error' => 'entityreference_invalid_entity',
+          'error' => 'entity_reference_invalid_entity',
           'message' => t('The referenced entity (@type: @id) is invalid.', array('@type' => $field['settings']['target_type'], '@id' => $id)),
         );
       }
@@ -111,17 +111,17 @@ function entityreference_field_validate($entity_type, $entity, $field, $instance
  * Build the whole form into a #process in which we actually have access
  * to the form state.
  */
-function entityreference_field_settings_form($field, $instance, $has_data) {
+function entity_reference_field_settings_form($field, $instance, $has_data) {
   $form = array(
     '#type' => 'container',
     '#attached' => array(
-      'css' => array(drupal_get_path('module', 'entityreference') . '/css/entityreference.admin.css'),
+      'css' => array(drupal_get_path('module', 'entity_reference') . '/css/entity_reference.admin.css'),
     ),
     '#process' => array(
-      '_entityreference_field_settings_process',
-      '_entityreference_field_settings_ajax_process',
+      '_entity_reference_field_settings_process',
+      '_entity_reference_field_settings_ajax_process',
     ),
-    '#element_validate' => array('_entityreference_field_settings_validate'),
+    '#element_validate' => array('_entity_reference_field_settings_validate'),
     '#field' => $field,
     '#instance' => $instance,
     '#has_data' => $has_data,
@@ -133,11 +133,11 @@ function entityreference_field_settings_form($field, $instance, $has_data) {
  * Render API callback: Processes the field settings form and allows access to
  * the form state.
  *
- * @see entityreference_field_settings_form()
+ * @see entity_reference_field_settings_form()
  */
-function _entityreference_field_settings_process($form, $form_state) {
-  $field = isset($form_state['entityreference']['field']) ? $form_state['entityreference']['field'] : $form['#field'];
-  $instance = isset($form_state['entityreference']['instance']) ? $form_state['entityreference']['instance'] : $form['#instance'];
+function _entity_reference_field_settings_process($form, $form_state) {
+  $field = isset($form_state['entity_reference']['field']) ? $form_state['entity_reference']['field'] : $form['#field'];
+  $instance = isset($form_state['entity_reference']['instance']) ? $form_state['entity_reference']['instance'] : $form['#instance'];
   $has_data = $form['#has_data'];
 
   $settings = $field['settings'];
@@ -163,10 +163,10 @@ function _entityreference_field_settings_process($form, $form_state) {
   );
 
   // Get all selection plugins for this entity type.
-  $selection_plugins = drupal_container()->get('plugin.manager.entityreference.selection')->getSelectionGroups($field['settings']['target_type']);
+  $selection_plugins = drupal_container()->get('plugin.manager.entity_reference.selection')->getSelectionGroups($field['settings']['target_type']);
   $handler_groups = array_keys($selection_plugins);
 
-  $handlers = drupal_container()->get('plugin.manager.entityreference.selection')->getDefinitions();
+  $handlers = drupal_container()->get('plugin.manager.entity_reference.selection')->getDefinitions();
   $handlers_options = array();
   foreach ($handlers as $plugin_id => $plugin) {
     // We only display Base plugins (e.g. 'base', 'views', ...) and not entity
@@ -180,7 +180,7 @@ function _entityreference_field_settings_process($form, $form_state) {
     '#type' => 'fieldset',
     '#title' => t('Entity selection'),
     '#tree' => TRUE,
-    '#process' => array('_entityreference_form_process_merge_parent'),
+    '#process' => array('_entity_reference_form_process_merge_parent'),
   );
 
   $form['handler']['handler'] = array(
@@ -199,15 +199,15 @@ function _entityreference_field_settings_process($form, $form_state) {
     '#attributes' => array(
       'class' => array('js-hide'),
     ),
-    '#submit' => array('entityreference_settings_ajax_submit'),
+    '#submit' => array('entity_reference_settings_ajax_submit'),
   );
 
   $form['handler']['handler_settings'] = array(
     '#type' => 'container',
-    '#attributes' => array('class' => array('entityreference-settings')),
+    '#attributes' => array('class' => array('entity_reference-settings')),
   );
 
-  $handler = entityreference_get_selection_handler($field, $instance);
+  $handler = entity_reference_get_selection_handler($field, $instance);
   $form['handler']['handler_settings'] += $handler->settingsForm($field, $instance);
 
   return $form;
@@ -217,41 +217,41 @@ function _entityreference_field_settings_process($form, $form_state) {
  * Render API callback: Processes the field settings form and allows access to
  * the form state.
  *
- * @see entityreference_field_settings_form()
+ * @see entity_reference_field_settings_form()
  */
-function _entityreference_field_settings_ajax_process($form, $form_state) {
-  _entityreference_field_settings_ajax_process_element($form, $form);
+function _entity_reference_field_settings_ajax_process($form, $form_state) {
+  _entity_reference_field_settings_ajax_process_element($form, $form);
   return $form;
 }
 
 /**
- * Adds entityreference specific properties to AJAX form elements from the field
+ * Adds entity_reference specific properties to AJAX form elements from the field
  * settings form.
  *
- * @see _entityreference_field_settings_ajax_process()
+ * @see _entity_reference_field_settings_ajax_process()
  */
-function _entityreference_field_settings_ajax_process_element(&$element, $main_form) {
+function _entity_reference_field_settings_ajax_process_element(&$element, $main_form) {
   if (isset($element['#ajax']) && $element['#ajax'] === TRUE) {
     $element['#ajax'] = array(
-      'callback' => 'entityreference_settings_ajax',
+      'callback' => 'entity_reference_settings_ajax',
       'wrapper' => $main_form['#id'],
       'element' => $main_form['#array_parents'],
     );
   }
 
   foreach (element_children($element) as $key) {
-    _entityreference_field_settings_ajax_process_element($element[$key], $main_form);
+    _entity_reference_field_settings_ajax_process_element($element[$key], $main_form);
   }
 }
 
 /**
- * Render API callback: Moves entityreference specific Form API elements
+ * Render API callback: Moves entity_reference specific Form API elements
  * (i.e. 'handler_settings') up a level for easier processing by the validation
  * and submission handlers.
  *
- * @see _entityreference_field_settings_process()
+ * @see _entity_reference_field_settings_process()
  */
-function _entityreference_form_process_merge_parent($element) {
+function _entity_reference_form_process_merge_parent($element) {
   $parents = $element['#parents'];
   array_pop($parents);
   $element['#parents'] = $parents;
@@ -261,7 +261,7 @@ function _entityreference_form_process_merge_parent($element) {
 /**
  * Form element validation handler; Filters the #value property of an element.
  */
-function _entityreference_element_validate_filter(&$element, &$form_state) {
+function _entity_reference_element_validate_filter(&$element, &$form_state) {
   $element['#value'] = array_filter($element['#value']);
   form_set_value($element, $element['#value'], $form_state);
 }
@@ -269,14 +269,14 @@ function _entityreference_element_validate_filter(&$element, &$form_state) {
 /**
  * Form element validation handler; Stores the new values in the form state.
  *
- * @see entityreference_field_settings_form()
+ * @see entity_reference_field_settings_form()
  */
-function _entityreference_field_settings_validate($form, &$form_state) {
+function _entity_reference_field_settings_validate($form, &$form_state) {
   $field = $form['#field'];
   if (isset($form_state['values']['field'])) {
     $field['settings'] = $form_state['values']['field']['settings'];
   }
-  $form_state['entityreference']['field'] = $field;
+  $form_state['entity_reference']['field'] = $field;
 
   unset($form_state['values']['field']['settings']['handler_submit']);
 }
@@ -284,9 +284,9 @@ function _entityreference_field_settings_validate($form, &$form_state) {
 /**
  * Ajax callback for the handler settings form.
  *
- * @see entityreference_field_settings_form()
+ * @see entity_reference_field_settings_form()
  */
-function entityreference_settings_ajax($form, $form_state) {
+function entity_reference_settings_ajax($form, $form_state) {
   $trigger = $form_state['triggering_element'];
   return NestedArray::getValue($form, $trigger['#ajax']['element']);
 }
@@ -294,17 +294,17 @@ function entityreference_settings_ajax($form, $form_state) {
 /**
  * Submit handler for the non-JS case.
  *
- * @see entityreference_field_settings_form()
+ * @see entity_reference_field_settings_form()
  */
-function entityreference_settings_ajax_submit($form, &$form_state) {
+function entity_reference_settings_ajax_submit($form, &$form_state) {
   $form_state['rebuild'] = TRUE;
 }
 
 /**
  * Implements hook_options_list().
  */
-function entityreference_options_list($field, $instance = NULL, $entity_type = NULL, $entity = NULL) {
-  if (!$options = entityreference_get_selection_handler($field, $instance, $entity)->getReferencableEntities()) {
+function entity_reference_options_list($field, $instance = NULL, $entity_type = NULL, $entity = NULL) {
+  if (!$options = entity_reference_get_selection_handler($field, $instance, $entity)->getReferencableEntities()) {
     return array();
   }
 
@@ -324,8 +324,8 @@ function entityreference_options_list($field, $instance = NULL, $entity_type = N
 /**
  * Implements hook_query_TAG_alter().
  */
-function entityreference_query_entityreference_alter(AlterableInterface $query) {
-  $handler = $query->getMetadata('entityreference_selection_handler');
+function entity_reference_query_entity_reference_alter(AlterableInterface $query) {
+  $handler = $query->getMetadata('entity_reference_selection_handler');
   $handler->entityFieldQueryAlter($query);
 }
 
@@ -344,7 +344,7 @@ function entityreference_query_entityreference_alter(AlterableInterface $query)
  * @return bool
  *   TRUE if user can access this menu item, FALSE otherwise.
  */
-function entityreference_autocomplete_access_callback($type, $field_name, $entity_type, $bundle_name) {
+function entity_reference_autocomplete_access_callback($type, $field_name, $entity_type, $bundle_name) {
   if (!$field = field_info_field($field_name)) {
     return FALSE;
   }
@@ -352,7 +352,7 @@ function entityreference_autocomplete_access_callback($type, $field_name, $entit
     return FALSE;
   }
 
-  if ($field['type'] != 'entityreference' || !field_access('edit', $field, $entity_type)) {
+  if ($field['type'] != 'entity_reference' || !field_access('edit', $field, $entity_type)) {
     return FALSE;
   }
 
@@ -378,11 +378,11 @@ function entityreference_autocomplete_access_callback($type, $field_name, $entit
  *
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
-function entityreference_autocomplete_callback($type, $field_name, $entity_type, $bundle_name, $entity_id = '', $string = '') {
+function entity_reference_autocomplete_callback($type, $field_name, $entity_type, $bundle_name, $entity_id = '', $string = '') {
   $field = field_info_field($field_name);
   $instance = field_info_instance($entity_type, $field_name, $bundle_name);
 
-  return entityreference_autocomplete_callback_get_matches($type, $field, $instance, $entity_type, $entity_id, $string);
+  return entity_reference_autocomplete_callback_get_matches($type, $field, $instance, $entity_type, $entity_id, $string);
 }
 
 /**
@@ -407,9 +407,9 @@ function entityreference_autocomplete_callback($type, $field_name, $entity_type,
  *
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  *
- * @see entityreference_autocomplete_callback()
+ * @see entity_reference_autocomplete_callback()
  */
-function entityreference_autocomplete_callback_get_matches($type, $field, $instance, $entity_type, $entity_id = '', $string = '') {
+function entity_reference_autocomplete_callback_get_matches($type, $field, $instance, $entity_type, $entity_id = '', $string = '') {
   $target_type = $field['settings']['target_type'];
   $matches = array();
   $entity = NULL;
@@ -422,7 +422,7 @@ function entityreference_autocomplete_callback_get_matches($type, $field, $insta
       return MENU_ACCESS_DENIED;
     }
   }
-  $handler = entityreference_get_selection_handler($field, $instance, $entity);
+  $handler = entity_reference_get_selection_handler($field, $instance, $entity);
 
   if ($type == 'tags') {
     // The user enters a comma-separated list of tags. We only autocomplete the
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\EntityreferenceBundle.
+ * Definition of Drupal\entity_reference\EntityReferenceBundle.
  */
 
-namespace Drupal\entityreference;
+namespace Drupal\entity_reference;
 
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\HttpKernel\Bundle\Bundle;
@@ -13,7 +13,7 @@ use Symfony\Component\HttpKernel\Bundle\Bundle;
 /**
  * Entity reference dependency injection container.
  */
-class EntityreferenceBundle extends Bundle {
+class EntityReferenceBundle extends Bundle {
 
   /**
    * Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
@@ -21,6 +21,6 @@ class EntityreferenceBundle extends Bundle {
   public function build(ContainerBuilder $container) {
     // Register the SelectionPluginManager class with the dependency injection
     // container.
-    $container->register('plugin.manager.entityreference.selection', 'Drupal\entityreference\Plugin\Type\SelectionPluginManager');
+    $container->register('plugin.manager.entity_reference.selection', 'Drupal\entity_reference\Plugin\Type\SelectionPluginManager');
   }
 }
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\Derivative\SelectionBase.
+ * Definition of Drupal\entity_reference\Plugin\Derivative\SelectionBase.
  */
 
-namespace Drupal\entityreference\Plugin\Derivative;
+namespace Drupal\entity_reference\Plugin\Derivative;
 
 use Drupal\Component\Plugin\Derivative\DerivativeInterface;
 
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\Type\Selection\SelectionBroken.
+ * Definition of Drupal\entity_reference\Plugin\Type\Selection\SelectionBroken.
  */
 
-namespace Drupal\entityreference\Plugin\Type\Selection;
+namespace Drupal\entity_reference\Plugin\Type\Selection;
 
 use Drupal\Core\Database\Query\SelectInterface;
 
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\Type\Selection\SelectionInterface.
+ * Definition of Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface.
  */
 
-namespace Drupal\entityreference\Plugin\Type\Selection;
+namespace Drupal\entity_reference\Plugin\Type\Selection;
 
 use Drupal\Core\Database\Query\SelectInterface;
 
@@ -15,7 +15,7 @@ use Drupal\Core\Database\Query\SelectInterface;
  * This interface details the methods that most plugin implementations will want
  * to override. See Drupal\field\Plugin\Type\Selection\SelectionBaseInterface
  * for base wrapping methods that should most likely be inherited directly from
- * Drupal\entityreference\Plugin\Type\Selection\SelectionBase.
+ * Drupal\entity_reference\Plugin\Type\Selection\SelectionBase.
  */
 interface SelectionInterface {
 
@@ -52,7 +52,7 @@ interface SelectionInterface {
    * @return int|null
    *   Value of a matching entity ID, or NULL if none.
    *
-   * @see \Drupal\entityreference\Plugin\field\widget::elementValidate()
+   * @see \Drupal\entity_reference\Plugin\field\widget::elementValidate()
    */
   public function validateAutocompleteInput($input, &$element, &$form_state, $form);
 
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\Type\SelectionPluginManager.
+ * Definition of Drupal\entity_reference\Plugin\Type\SelectionPluginManager.
  */
 
-namespace Drupal\entityreference\Plugin\Type;
+namespace Drupal\entity_reference\Plugin\Type;
 
 use Drupal\Component\Plugin\Exception\PluginException;
 use Drupal\Component\Plugin\Factory\ReflectionFactory;
@@ -13,7 +13,7 @@ use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Core\Plugin\Discovery\AlterDecorator;
 use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
 use Drupal\Core\Plugin\Discovery\CacheDecorator;
-use Drupal\entityreference\Plugin\Type\Selection\SelectionBroken;
+use Drupal\entity_reference\Plugin\Type\Selection\SelectionBroken;
 
 /**
  * Plugin type manager for the Entity Reference Selection plugin.
@@ -24,8 +24,8 @@ class SelectionPluginManager extends PluginManagerBase {
    * Constructs a SelectionPluginManager object.
    */
   public function __construct() {
-    $this->baseDiscovery = new AlterDecorator(new AnnotatedClassDiscovery('entityreference', 'selection'), 'entityreference_selection');
-    $this->discovery = new CacheDecorator($this->baseDiscovery, 'entityreference_selection');
+    $this->baseDiscovery = new AlterDecorator(new AnnotatedClassDiscovery('entity_reference', 'selection'), 'entity_reference_selection');
+    $this->discovery = new CacheDecorator($this->baseDiscovery, 'entity_reference_selection');
     $this->factory = new ReflectionFactory($this);
   }
 
@@ -2,22 +2,22 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\entityreference\selection\Comment.
+ * Definition of Drupal\entity_reference\Plugin\entity_reference\selection\Comment.
  */
 
-namespace Drupal\entityreference\Plugin\entityreference\selection;
+namespace Drupal\entity_reference\Plugin\entity_reference\selection;
 
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\entityreference\Plugin\entityreference\selection\SelectionBase;
+use Drupal\entity_reference\Plugin\entity_reference\selection\SelectionBase;
 
 /**
  * Provides specific access control for the comment entity type.
  *
  * @Plugin(
  *   id = "base_comment",
- *   module = "entityreference",
+ *   module = "entity_reference",
  *   group = "base",
  *   entity_types = {"comment"},
  *   weight = 1,
@@ -2,22 +2,22 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\Type\selection\File.
+ * Definition of Drupal\entity_reference\Plugin\Type\selection\File.
  */
 
-namespace Drupal\entityreference\Plugin\entityreference\selection;
+namespace Drupal\entity_reference\Plugin\entity_reference\selection;
 
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\entityreference\Plugin\entityreference\selection\SelectionBase;
+use Drupal\entity_reference\Plugin\entity_reference\selection\SelectionBase;
 
 /**
  * Provides specific access control for the file entity type.
  *
  * @Plugin(
  *   id = "base_file",
- *   module = "entityreference",
+ *   module = "entity_reference",
  *   group = "base",
  *   entity_types = {"file"},
  *   weight = 1,
@@ -2,22 +2,22 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\Type\selection\Node.
+ * Definition of Drupal\entity_reference\Plugin\Type\selection\Node.
  */
 
-namespace Drupal\entityreference\Plugin\entityreference\selection;
+namespace Drupal\entity_reference\Plugin\entity_reference\selection;
 
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\entityreference\Plugin\entityreference\selection\SelectionBase;
+use Drupal\entity_reference\Plugin\entity_reference\selection\SelectionBase;
 
 /**
  * Provides specific access control for the node entity type.
  *
  * @Plugin(
  *   id = "base_node",
- *   module = "entityreference",
+ *   module = "entity_reference",
  *   group = "base",
  *   entity_types = {"node"},
  *   weight = 1,
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\entityreference\selection\SelectionBase.
+ * Definition of Drupal\entity_reference\Plugin\entity_reference\selection\SelectionBase.
  */
 
-namespace Drupal\entityreference\Plugin\entityreference\selection;
+namespace Drupal\entity_reference\Plugin\entity_reference\selection;
 
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
@@ -13,18 +13,18 @@ use Drupal\Core\Database\Query\AlterableInterface;
 use Drupal\Core\Database\Query\SelectInterface;
 use Drupal\Core\Entity\EntityFieldQuery;
 use Drupal\Core\Entity\EntityInterface;
-use Drupal\entityreference\Plugin\Type\Selection\SelectionInterface;
+use Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface;
 
 /**
- * Plugin implementation of the 'selection' entityreference.
+ * Plugin implementation of the 'selection' entity_reference.
  *
  * @Plugin(
  *   id = "base",
- *   module = "entityreference",
+ *   module = "entity_reference",
  *   label = @Translation("Simple selection"),
  *   group = "base",
  *   weight = 0,
- *   derivative = "Drupal\entityreference\Plugin\Derivative\SelectionBase"
+ *   derivative = "Drupal\entity_reference\Plugin\Derivative\SelectionBase"
  * )
  */
 class SelectionBase implements SelectionInterface {
@@ -66,7 +66,7 @@ class SelectionBase implements SelectionInterface {
         '#size' => 6,
         '#multiple' => TRUE,
         '#description' => t('The bundles of the entity type that can be referenced. Optional, leave empty for all bundles.'),
-        '#element_validate' => array('_entityreference_element_validate_filter'),
+        '#element_validate' => array('_entity_reference_element_validate_filter'),
       );
     }
     else {
@@ -91,8 +91,8 @@ class SelectionBase implements SelectionInterface {
 
     $form['sort']['settings'] = array(
       '#type' => 'container',
-      '#attributes' => array('class' => array('entityreference-settings')),
-      '#process' => array('_entityreference_form_process_merge_parent'),
+      '#attributes' => array('class' => array('entity_reference-settings')),
+      '#process' => array('_entity_reference_form_process_merge_parent'),
     );
 
     if ($field['settings']['handler_settings']['sort']['type'] == 'property') {
@@ -258,9 +258,9 @@ class SelectionBase implements SelectionInterface {
 
     // Add a generic entity access tag to the query.
     $query->addTag($this->field['settings']['target_type'] . '_access');
-    $query->addTag('entityreference');
+    $query->addTag('entity_reference');
     $query->addMetaData('field', $this->field);
-    $query->addMetaData('entityreference_selection_handler', $this);
+    $query->addMetaData('entity_reference_selection_handler', $this);
 
     // Add the sort option.
     if (!empty($this->field['settings']['handler_settings']['sort'])) {
@@ -2,22 +2,22 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\entityreference\selection\\Term.
+ * Definition of Drupal\entity_reference\Plugin\entity_reference\selection\Term.
  */
 
-namespace Drupal\entityreference\Plugin\entityreference\selection;
+namespace Drupal\entity_reference\Plugin\entity_reference\selection;
 
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\entityreference\Plugin\entityreference\selection\SelectionBase;
+use Drupal\entity_reference\Plugin\entity_reference\selection\SelectionBase;
 
 /**
  * Provides specific access control for the taxonomy_term entity type.
  *
  * @Plugin(
  *   id = "base_taxonomy_term",
- *   module = "entityreference",
+ *   module = "entity_reference",
  *   group = "base",
  *   entity_types = {"taxonomy_term"},
  *   weight = 1,
@@ -2,23 +2,23 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\entityreference\selection\User.
+ * Definition of Drupal\entity_reference\Plugin\entity_reference\selection\User.
  */
 
-namespace Drupal\entityreference\Plugin\entityreference\selection;
+namespace Drupal\entity_reference\Plugin\entity_reference\selection;
 
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Database\Database;
 use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\entityreference\Plugin\entityreference\selection\SelectionBase;
+use Drupal\entity_reference\Plugin\entity_reference\selection\SelectionBase;
 
 /**
  * Provides specific access control for the user entity type.
  *
  * @Plugin(
  *   id = "base_user",
- *   module = "entityreference",
+ *   module = "entity_reference",
  *   group = "base",
  *   entity_types = {"user"},
  *   weight = 1,
@@ -2,27 +2,27 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\field\formatter\EntityReferenceEntityFormatter.
+ * Definition of Drupal\entity_reference\Plugin\field\formatter\EntityReferenceEntityFormatter.
  */
 
-namespace Drupal\entityreference\Plugin\field\formatter;
+namespace Drupal\entity_reference\Plugin\field\formatter;
 
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Entity\EntityInterface;
-use Drupal\entityreference\EntityReferenceRecursiveRenderingException;
-use Drupal\entityreference\Plugin\field\formatter\EntityReferenceFormatterBase;
+use Drupal\entity_reference\EntityReferenceRecursiveRenderingException;
+use Drupal\entity_reference\Plugin\field\formatter\EntityReferenceFormatterBase;
 
 /**
  * Plugin implementation of the 'entity-reference rendered entity' formatter.
  *
  * @Plugin(
- *   id = "entityreference_entity_view",
- *   module = "entityreference",
+ *   id = "entity_reference_entity_view",
+ *   module = "entity_reference",
  *   label = @Translation("Rendered entity"),
  *   description = @Translation("Display the referenced entities rendered by entity_view()."),
  *   field_types = {
- *     "entityreference"
+ *     "entity_reference"
  *   },
  *   settings = {
  *     "view_mode" = "",
@@ -33,7 +33,7 @@ use Drupal\entityreference\Plugin\field\formatter\EntityReferenceFormatterBase;
 class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase {
 
   /**
-   * Overrides Drupal\entityreference\Plugin\field\formatter\EntityReferenceFormatterBase::settingsForm().
+   * Overrides Drupal\entity_reference\Plugin\field\formatter\EntityReferenceFormatterBase::settingsForm().
    */
   public function settingsForm(array $form, array &$form_state) {
     $entity_info = entity_get_info($this->field['settings']['target_type']);
@@ -76,7 +76,7 @@ class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase {
   }
 
   /**
-   * Overrides Drupal\entityreference\Plugin\field\formatter\EntityReferenceFormatterBase::viewElements().
+   * Overrides Drupal\entity_reference\Plugin\field\formatter\EntityReferenceFormatterBase::viewElements().
    */
   public function viewElements(EntityInterface $entity, $langcode, array $items) {
     // Remove un-accessible items.
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\field\formatter\EntityReferenceFormatterBase.
+ * Definition of Drupal\entity_reference\Plugin\field\formatter\EntityReferenceFormatterBase.
  */
 
-namespace Drupal\entityreference\Plugin\field\formatter;
+namespace Drupal\entity_reference\Plugin\field\formatter;
 
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
@@ -72,7 +72,7 @@ abstract class EntityReferenceFormatterBase extends FormatterBase {
   /**
    * Overrides Drupal\field\Plugin\Type\Formatter\FormatterBase::viewElements().
    *
-   * @see Drupal\entityreference\Plugin\field\formatter\EntityReferenceFormatterBase::prepareView().
+   * @see Drupal\entity_reference\Plugin\field\formatter\EntityReferenceFormatterBase::prepareView().
    */
   public function viewElements(EntityInterface $entity, $langcode, array $items) {
     // Remove un-accessible items.
@@ -2,33 +2,33 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\field\formatter\EntityReferenceIdFormatter.
+ * Definition of Drupal\entity_reference\Plugin\field\formatter\EntityReferenceIdFormatter.
  */
 
-namespace Drupal\entityreference\Plugin\field\formatter;
+namespace Drupal\entity_reference\Plugin\field\formatter;
 
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Entity\EntityInterface;
-use Drupal\entityreference\Plugin\field\formatter\EntityReferenceFormatterBase;
+use Drupal\entity_reference\Plugin\field\formatter\EntityReferenceFormatterBase;
 
 /**
  * Plugin implementation of the 'entity-reference ID' formatter.
  *
  * @Plugin(
- *   id = "entityreference_entity_id",
- *   module = "entityreference",
+ *   id = "entity_reference_entity_id",
+ *   module = "entity_reference",
  *   label = @Translation("Entity ID"),
  *   description = @Translation("Display the ID of the referenced entities."),
  *   field_types = {
- *     "entityreference"
+ *     "entity_reference"
  *   }
  * )
  */
 class EntityReferenceIdFormatter extends EntityReferenceFormatterBase {
 
   /**
-   * Overrides Drupal\entityreference\Plugin\field\formatter\EntityReferenceFormatterBase::viewElements().
+   * Overrides Drupal\entity_reference\Plugin\field\formatter\EntityReferenceFormatterBase::viewElements().
    */
   public function viewElements(EntityInterface $entity, $langcode, array $items) {
     $elements = array();
@@ -2,26 +2,26 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\field\formatter\EntityReferenceLabelFormatter.
+ * Definition of Drupal\entity_reference\Plugin\field\formatter\EntityReferenceLabelFormatter.
  */
 
-namespace Drupal\entityreference\Plugin\field\formatter;
+namespace Drupal\entity_reference\Plugin\field\formatter;
 
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Entity\EntityInterface;
-use Drupal\entityreference\Plugin\field\formatter\EntityReferenceFormatterBase;
+use Drupal\entity_reference\Plugin\field\formatter\EntityReferenceFormatterBase;
 
 /**
  * Plugin implementation of the 'entity-reference label' formatter.
  *
  * @Plugin(
- *   id = "entityreference_label",
- *   module = "entityreference",
+ *   id = "entity_reference_label",
+ *   module = "entity_reference",
  *   label = @Translation("Label"),
  *   description = @Translation("Display the label of the referenced entities."),
  *   field_types = {
- *     "entityreference"
+ *     "entity_reference"
  *   },
  *   settings = {
  *     "link" = "FALSE"
@@ -54,7 +54,7 @@ class EntityReferenceLabelFormatter extends EntityReferenceFormatterBase {
   }
 
   /**
-   * Overrides Drupal\entityreference\Plugin\field\formatter\EntityReferenceFormatterBase::viewElements().
+   * Overrides Drupal\entity_reference\Plugin\field\formatter\EntityReferenceFormatterBase::viewElements().
    */
   public function viewElements(EntityInterface $entity, $langcode, array $items) {
     // Remove un-accessible items.
@@ -2,17 +2,17 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\field\widget\AutocompleteTagsWidget.
+ * Definition of Drupal\entity_reference\Plugin\field\widget\AutocompleteTagsWidget.
  */
 
-namespace Drupal\entityreference\Plugin\field\widget;
+namespace Drupal\entity_reference\Plugin\field\widget;
 
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
-use Drupal\entityreference\Plugin\field\widget\AutocompleteWidgetBase;
+use Drupal\entity_reference\Plugin\field\widget\AutocompleteWidgetBase;
 
 /**
- * Plugin implementation of the 'entityreference autocomplete-tags' widget.
+ * Plugin implementation of the 'entity_reference autocomplete-tags' widget.
  *
  * @todo: Check if the following statement is still correct
  * The autocomplete path doesn't have a default here, because it's not the
@@ -20,12 +20,12 @@ use Drupal\entityreference\Plugin\field\widget\AutocompleteWidgetBase;
  * the widget changes.
  *
  * @Plugin(
- *   id = "entityreference_autocomplete_tags",
- *   module = "entityreference",
+ *   id = "entity_reference_autocomplete_tags",
+ *   module = "entity_reference",
  *   label = @Translation("Autocomplete (Tags style)"),
  *   description = @Translation("An autocomplete text field."),
  *   field_types = {
- *     "entityreference"
+ *     "entity_reference"
  *   },
  *   settings = {
  *     "match_operator" = "CONTAINS",
@@ -38,14 +38,14 @@ use Drupal\entityreference\Plugin\field\widget\AutocompleteWidgetBase;
 class AutocompleteTagsWidget extends AutocompleteWidgetBase {
 
   /**
-   * Overrides Drupal\entityreference\Plugin\field\widget\AutocompleteWidgetBase::formElement().
+   * Overrides Drupal\entity_reference\Plugin\field\widget\AutocompleteWidgetBase::formElement().
    */
   public function formElement(array $items, $delta, array $element, $langcode, array &$form, array &$form_state) {
-    return $this->prepareElement($items, $delta, $element, $langcode, $form, $form_state, 'entityreference/autocomplete/tags');
+    return $this->prepareElement($items, $delta, $element, $langcode, $form, $form_state, 'entity_reference/autocomplete/tags');
   }
 
   /**
-   * Overrides Drupal\entityreference\Plugin\field\widget\AutocompleteWidgetBase::elementValidate()
+   * Overrides Drupal\entity_reference\Plugin\field\widget\AutocompleteWidgetBase::elementValidate()
    */
   public function elementValidate($element, &$form_state) {
     $value = array();
@@ -64,7 +64,7 @@ class AutocompleteTagsWidget extends AutocompleteWidgetBase {
           // Try to get a match from the input string when the user didn't use the
           // autocomplete but filled in a value manually.
         $instance = field_info_instance($element['#entity_type'], $element['#field_name'], $element['#bundle']);
-        $handler = entityreference_get_selection_handler($field, $instance);
+        $handler = entity_reference_get_selection_handler($field, $instance);
           $value[] = array(
             'target_id' => $handler->validateAutocompleteInput($entity, $element, $form_state, $form),
           );
@@ -2,17 +2,17 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\field\widget\AutocompleteWidget.
+ * Definition of Drupal\entity_reference\Plugin\field\widget\AutocompleteWidget.
  */
 
-namespace Drupal\entityreference\Plugin\field\widget;
+namespace Drupal\entity_reference\Plugin\field\widget;
 
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
-use Drupal\entityreference\Plugin\field\widget\AutocompleteWidgetBase;
+use Drupal\entity_reference\Plugin\field\widget\AutocompleteWidgetBase;
 
 /**
- * Plugin implementation of the 'entityreference autocomplete' widget.
+ * Plugin implementation of the 'entity_reference autocomplete' widget.
  *
  * @todo: Check if the following statement is still correct
  * The autocomplete path doesn't have a default here, because it's not the
@@ -20,12 +20,12 @@ use Drupal\entityreference\Plugin\field\widget\AutocompleteWidgetBase;
  * the widget changes.
  *
  * @Plugin(
- *   id = "entityreference_autocomplete",
- *   module = "entityreference",
+ *   id = "entity_reference_autocomplete",
+ *   module = "entity_reference",
  *   label = @Translation("Autocomplete"),
  *   description = @Translation("An autocomplete text field."),
  *   field_types = {
- *     "entityreference"
+ *     "entity_reference"
  *   },
  *   settings = {
  *     "match_operator" = "CONTAINS",
@@ -37,7 +37,7 @@ use Drupal\entityreference\Plugin\field\widget\AutocompleteWidgetBase;
 class AutocompleteWidget extends AutocompleteWidgetBase {
 
   /**
-   * Overrides Drupal\entityreference\Plugin\field\widget\AutocompleteWidgetBase::formElement().
+   * Overrides Drupal\entity_reference\Plugin\field\widget\AutocompleteWidgetBase::formElement().
    */
   public function formElement(array $items, $delta, array $element, $langcode, array &$form, array &$form_state) {
     // We let the Field API handles multiple values for us, only take care of
@@ -49,12 +49,12 @@ class AutocompleteWidget extends AutocompleteWidgetBase {
       $items = array();
     }
 
-    $element = $this->prepareElement($items, $delta, $element, $langcode, $form, $form_state, 'entityreference/autocomplete/single');
+    $element = $this->prepareElement($items, $delta, $element, $langcode, $form, $form_state, 'entity_reference/autocomplete/single');
     return array('target_id' => $element);
   }
 
   /**
-   * Overrides Drupal\entityreference\Plugin\field\widget\AutocompleteWidgetBase::elementValidate()
+   * Overrides Drupal\entity_reference\Plugin\field\widget\AutocompleteWidgetBase::elementValidate()
    */
   public function elementValidate($element, &$form_state) {
     // If a value was entered into the autocomplete.
@@ -69,7 +69,7 @@ class AutocompleteWidget extends AutocompleteWidgetBase {
         // autocomplete but filled in a value manually.
         $field = field_info_field($element['#field_name']);
         $instance = field_info_instance($element['#entity_type'], $element['#field_name'], $element['#bundle']);
-        $handler = entityreference_get_selection_handler($field, $instance);
+        $handler = entity_reference_get_selection_handler($field, $instance);
         $value = $handler->validateAutocompleteInput($element['#value'], $element, $form_state, $form);
       }
     }
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\field\widget\AutocompleteWidgetBase.
+ * Definition of Drupal\entity_reference\Plugin\field\widget\AutocompleteWidgetBase.
  */
 
-namespace Drupal\entityreference\Plugin\field\widget;
+namespace Drupal\entity_reference\Plugin\field\widget;
 
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
@@ -47,7 +47,7 @@ abstract class AutocompleteWidgetBase extends WidgetBase {
    * Implements Drupal\field\Plugin\Type\Widget\WidgetInterface::formElement().
    */
   public function formElement(array $items, $delta, array $element, $langcode, array &$form, array &$form_state) {
-    $element = $this->prepareElement($items, $delta, $element, $langcode, $form, $form_state, 'entityreference/autocomplete/single');
+    $element = $this->prepareElement($items, $delta, $element, $langcode, $form, $form_state, 'entity_reference/autocomplete/single');
     return array('target_id' => $element);
   }
 
@@ -2,27 +2,27 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\views\display\Entityreference.
+ * Definition of Drupal\entity_reference\Plugin\views\display\EntityReference.
  */
 
-namespace Drupal\entityreference\Plugin\views\display;
+namespace Drupal\entity_reference\Plugin\views\display;
 
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\views\Plugin\views\display\DisplayPluginBase;
 
 /**
- * The plugin that handles an Entityreference display.
+ * The plugin that handles an EntityReference display.
  *
- * "entityreference_display" is a custom property, used with
+ * "entity_reference_display" is a custom property, used with
  * views_get_applicable_views() to retrieve all views with a
  * 'Entity Reference' display.
  *
  * @ingroup views_display_plugins
  *
  * @Plugin(
- *   id = "entityreference",
- *   title = @Translation("Entityreference"),
+ *   id = "entity_reference",
+ *   title = @Translation("EntityReference"),
  *   admin = @Translation("Entity Reference Source"),
  *   help = @Translation("Selects referenceable entities for an entity reference field."),
  *   theme = "views_view",
@@ -30,10 +30,10 @@ use Drupal\views\Plugin\views\display\DisplayPluginBase;
  *   use_ajax = FALSE,
  *   use_pager = FALSE,
  *   accept_attachments = FALSE,
-  *  entityreference_display = TRUE
+  *  entity_reference_display = TRUE
  * )
  */
-class Entityreference extends DisplayPluginBase {
+class EntityReference extends DisplayPluginBase {
 
   /**
    * Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::defineOptions().
@@ -41,11 +41,11 @@ class Entityreference extends DisplayPluginBase {
   protected function defineOptions() {
     $options = parent::defineOptions();
 
-    // Force the style plugin to 'entityreference_style' and the row plugin to
+    // Force the style plugin to 'entity_reference_style' and the row plugin to
     // 'fields'.
-    $options['style']['contains']['type'] = array('default' => 'entityreference');
+    $options['style']['contains']['type'] = array('default' => 'entity_reference');
     $options['defaults']['default']['style'] = FALSE;
-    $options['row']['contains']['type'] = array('default' => 'entityreference');
+    $options['row']['contains']['type'] = array('default' => 'entity_reference');
     $options['defaults']['default']['row'] = FALSE;
 
     // Make sure the query is not cached.
@@ -62,7 +62,7 @@ class Entityreference extends DisplayPluginBase {
    * Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::getStyleType().
    */
   protected function getStyleType() {
-    return 'entityreference';
+    return 'entity_reference';
   }
 
   /**
@@ -93,7 +93,7 @@ class Entityreference extends DisplayPluginBase {
    * Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::query().
    */
   public function query() {
-    $options = $this->getOption('entityreference_options');
+    $options = $this->getOption('entity_reference_options');
 
     // Play nice with Views UI 'preview' : if the view is not executed through
     // EntityReference_SelectionHandler_Views::getReferencableEntities(),
@@ -2,29 +2,29 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\views\row\Entityreference.
+ * Definition of Drupal\entity_reference\Plugin\views\row\EntityReference.
  */
 
-namespace Drupal\entityreference\Plugin\views\row;
+namespace Drupal\entity_reference\Plugin\views\row;
 
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\views\Plugin\views\row\Fields;
 
 /**
- * Entityreference row plugin.
+ * EntityReference row plugin.
  *
  * @ingroup views_row_plugins
  *
  * @Plugin(
- *   id = "entityreference",
+ *   id = "entity_reference",
  *   title = @Translation("Entity Reference inline fields"),
  *   help = @Translation("Displays the fields with an optional template."),
  *   theme = "views_view_fields",
- *   type = "entityreference"
+ *   type = "entity_reference"
  * )
  */
-class Entityreference extends Fields {
+class EntityReference extends Fields {
 
   /**
    * Overrides Drupal\views\Plugin\views\row\Fields::defineOptions().
@@ -2,29 +2,29 @@
 
 /**
  * @file
- * Definition of Drupal\entityreference\Plugin\views\style\Entityreference.
+ * Definition of Drupal\entity_reference\Plugin\views\style\EntityReference.
  */
 
-namespace Drupal\entityreference\Plugin\views\style;
+namespace Drupal\entity_reference\Plugin\views\style;
 
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\views\Plugin\views\style\StylePluginBase;
 
 /**
- * Entityreference style plugin.
+ * EntityReference style plugin.
  *
  * @ingroup views_style_plugins
  *
  * @Plugin(
- *   id = "entityreference",
+ *   id = "entity_reference",
  *   title = @Translation("Entity Reference list"),
  *   help = @Translation("Returns results as a PHP array of labels and rendered rows."),
  *   theme = "views_view_unformatted",
- *   type = "entityreference"
+ *   type = "entity_reference"
  * )
  */
-class Entityreference extends StylePluginBase {
+class EntityReference extends StylePluginBase {
 
   protected $usesRowPlugin = TRUE;
 
@@ -66,10 +66,10 @@ class Entityreference extends StylePluginBase {
    * Overrides Drupal\views\Plugin\views\style\StylePluginBase\StylePluginBase::render().
    */
   public function render() {
-    $options = $this->displayHandler->getOption('entityreference_options');
+    $options = $this->displayHandler->getOption('entity_reference_options');
 
     // Play nice with Views UI 'preview': if the view is not executed through
-    // Drupal\views\Plugin\entityreference\selection\Views::getReferencableEntities(),
+    // Drupal\views\Plugin\entity_reference\selection\Views::getReferencableEntities(),
     // just display the HTML.
     if (empty($options)) {
       return parent::render();
@@ -78,7 +78,7 @@ class Entityreference extends StylePluginBase {
     // Group the rows according to the grouping field, if specified.
     $sets = $this->render_grouping($this->view->result, $this->options['grouping']);
 
-    // Grab the alias of the 'id' field added by entityreference_plugin_display.
+    // Grab the alias of the 'id' field added by entity_reference_plugin_display.
     $id_field_alias = $this->displayHandler->id_field_alias;
 
     // @todo We don't display grouping info for now. Could be useful for select
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains Drupal\entityreference\Tests\EntityReferenceAdminTest.
+ * Contains Drupal\entity_reference\Tests\EntityReferenceAdminTest.
  */
 
-namespace Drupal\entityreference\Tests;
+namespace Drupal\entity_reference\Tests;
 
 use Drupal\simpletest\WebTestBase;
 
@@ -21,7 +21,7 @@ class EntityReferenceAdminTest extends WebTestBase {
     );
   }
 
-  public static $modules = array('field_ui', 'entityreference');
+  public static $modules = array('field_ui', 'entity_reference');
 
   public function setUp() {
     parent::setUp();
@@ -69,8 +69,8 @@ class EntityReferenceAdminTest extends WebTestBase {
     $this->drupalPost($bundle_path . '/fields', array(
       'fields[_add_new_field][label]' => 'Test label',
       'fields[_add_new_field][field_name]' => 'test',
-      'fields[_add_new_field][type]' => 'entityreference',
-      'fields[_add_new_field][widget_type]' => 'entityreference_autocomplete',
+      'fields[_add_new_field][type]' => 'entity_reference',
+      'fields[_add_new_field][widget_type]' => 'entity_reference_autocomplete',
     ), t('Save'));
 
     // Node should be selected by default.
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains Drupal\entityreference\Tests\EntityReferenceSelectionAccessTest.
+ * Contains Drupal\entity_reference\Tests\EntityReferenceSelectionAccessTest.
  */
 
-namespace Drupal\entityreference\Tests;
+namespace Drupal\entity_reference\Tests;
 
 use Drupal\simpletest\WebTestBase;
 
@@ -22,7 +22,7 @@ class EntityReferenceSelectionAccessTest extends WebTestBase {
     );
   }
 
-  public static $modules = array('node', 'comment', 'entityreference');
+  public static $modules = array('node', 'comment', 'entity_reference');
 
   function setUp() {
     parent::setUp();
@@ -34,7 +34,7 @@ class EntityReferenceSelectionAccessTest extends WebTestBase {
   }
 
   protected function assertReferencable($field, $tests, $handler_name) {
-    $handler = entityreference_get_selection_handler($field);
+    $handler = entity_reference_get_selection_handler($field);
 
     foreach ($tests as $test) {
       foreach ($test['arguments'] as $arguments) {
@@ -71,7 +71,7 @@ class EntityReferenceSelectionAccessTest extends WebTestBase {
         ),
       ),
       'field_name' => 'test_field',
-      'type' => 'entityreference',
+      'type' => 'entity_reference',
       'cardinality' => '1',
     );
 
@@ -205,7 +205,7 @@ class EntityReferenceSelectionAccessTest extends WebTestBase {
         ),
       ),
       'field_name' => 'test_field',
-      'type' => 'entityreference',
+      'type' => 'entity_reference',
       'cardinality' => '1',
     );
 
@@ -341,7 +341,7 @@ class EntityReferenceSelectionAccessTest extends WebTestBase {
         ),
       ),
       'field_name' => 'test_field',
-      'type' => 'entityreference',
+      'type' => 'entity_reference',
       'cardinality' => '1',
     );
 
diff --git a/core/modules/field/modules/entityreference/css/entityreference-rtl.admin.css b/core/modules/field/modules/entityreference/css/entityreference-rtl.admin.css
deleted file mode 100644 (file)
index 600e3d7..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-
-.entityreference-settings {
-  margin-right: 1.5em;
-}
index 4436089..55a3bc5 100644 (file)
@@ -437,14 +437,14 @@ function options_field_widget_info() {
   return array(
     'options_select' => array(
       'label' => t('Select list'),
-      'field types' => array('list_integer', 'list_float', 'list_text', 'entityreference'),
+      'field types' => array('list_integer', 'list_float', 'list_text', 'entity_reference'),
       'behaviors' => array(
         'multiple values' => FIELD_BEHAVIOR_CUSTOM,
       ),
     ),
     'options_buttons' => array(
       'label' => t('Check boxes/radio buttons'),
-      'field types' => array('list_integer', 'list_float', 'list_text', 'list_boolean', 'entityreference'),
+      'field types' => array('list_integer', 'list_float', 'list_text', 'list_boolean', 'entity_reference'),
       'behaviors' => array(
         'multiple values' => FIELD_BEHAVIOR_CUSTOM,
       ),
@@ -2,23 +2,23 @@
 
 /**
  * @file
- * Definition of Drupal\views\Plugin\entityreference\selection\Views.
+ * Definition of Drupal\views\Plugin\entity_reference\selection\Views.
  */
 
-namespace Drupal\views\Plugin\entityreference\selection;
+namespace Drupal\views\Plugin\entity_reference\selection;
 
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Database\Query\SelectInterface;
 use Drupal\Core\Entity\EntityInterface;
-use Drupal\entityreference\Plugin\Type\Selection\SelectionInterface;
+use Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface;
 
 /**
- * Plugin implementation of the 'selection' entityreference.
+ * Plugin implementation of the 'selection' entity_reference.
  *
  * @Plugin(
  *   id = "views",
- *   module = "entityreference",
+ *   module = "entity_reference",
  *   group = "views",
  *   weight = "0",
  *   label = @Translation("Views: Filter by an entity reference view")
@@ -38,11 +38,11 @@ class Views implements SelectionInterface {
   }
 
   /**
-   * Implements Drupal\entityreference\Plugin\Type\Selection\SelectionInterface::settingsForm().
+   * Implements Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface::settingsForm().
    */
   public static function settingsForm($field, $instance) {
     $view_settings = empty($field['settings']['handler_settings']['view']) ? '' : $field['settings']['handler_settings']['view'];
-    $displays = views_get_applicable_views('entityreference_display');
+    $displays = views_get_applicable_views('entity_reference_display');
     // Filter views that list the entity type we want, and group the separate
     // displays by view.
     $entity_info = entity_get_info($field['settings']['target_type']);
@@ -112,24 +112,24 @@ class Views implements SelectionInterface {
     // Check that the view is valid and the display still exists.
     $this->view = views_get_view($view_name);
     if (!$this->view || !isset($this->view->storage->display[$display_name]) || !$this->view->access($display_name)) {
-      watchdog('entityreference', 'The view %view_name is no longer eligible for the %field_name field.', array('%view_name' => $view_name, '%field_name' => $this->instance['label']), WATCHDOG_WARNING);
+      watchdog('entity_reference', 'The view %view_name is no longer eligible for the %field_name field.', array('%view_name' => $view_name, '%field_name' => $this->instance['label']), WATCHDOG_WARNING);
       return FALSE;
     }
     $this->view->setDisplay($display_name);
 
     // Pass options to the display handler to make them available later.
-    $entityreference_options = array(
+    $entity_reference_options = array(
       'match' => $match,
       'match_operator' => $match_operator,
       'limit' => $limit,
       'ids' => $ids,
     );
-    $this->view->displayHandlers[$display_name]->setOption('entityreference_options', $entityreference_options);
+    $this->view->displayHandlers[$display_name]->setOption('entity_reference_options', $entity_reference_options);
     return TRUE;
   }
 
   /**
-   * Implements Drupal\entityreference\Plugin\Type\Selection\SelectionInterface::getReferencableEntities().
+   * Implements Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface::getReferencableEntities().
    */
   public function getReferencableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
     $display_name = $this->field['settings']['handler_settings']['view']['display_name'];
@@ -153,7 +153,7 @@ class Views implements SelectionInterface {
   }
 
   /**
-   * Implements Drupal\entityreference\Plugin\Type\Selection\SelectionInterface::countReferencableEntities().
+   * Implements Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface::countReferencableEntities().
    */
   public function countReferencableEntities($match = NULL, $match_operator = 'CONTAINS') {
     $this->getReferencableEntities($match, $match_operator);
@@ -161,7 +161,7 @@ class Views implements SelectionInterface {
   }
 
   /**
-   * Implements Drupal\entityreference\Plugin\Type\Selection\SelectionInterface::validateReferencableEntities().
+   * Implements Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface::validateReferencableEntities().
    */
   public function validateReferencableEntities(array $ids) {
     $display_name = $this->field['settings']['handler_settings']['view']['display_name'];
@@ -176,14 +176,14 @@ class Views implements SelectionInterface {
   }
 
   /**
-   * Implements Drupal\entityreference\Plugin\Type\Selection\SelectionInterface::validateAutocompleteInput().
+   * Implements Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface::validateAutocompleteInput().
    */
   public function validateAutocompleteInput($input, &$element, &$form_state, $form) {
     return NULL;
   }
 
   /**
-   * Implements Drupal\entityreference\Plugin\Type\Selection\SelectionInterface::entityFieldQueryAlter().
+   * Implements Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface::entityFieldQueryAlter().
    */
   public function entityFieldQueryAlter(SelectInterface $query) { }