Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293443

Rename hook_entity_info()

$
0
0

Problem/Motivation

In D8, the @EntityType annotation has take over the role of D7's hook_entity_info().

However, hook_entity_info() has been retained as a way for modules to provide default values under certain conditions.

One example of this is Views UI:

/**
* Implements hook_entity_info().
*/
function views_ui_entity_info(&$entity_info) {
  $entity_info['view']['controllers'] += array(
    'list' => 'Drupal\views_ui\ViewListController',
    'form' => array(
      'edit' => 'Drupal\views_ui\ViewEditFormController',
      'add' => 'Drupal\views_ui\ViewAddFormController',
      'preview' => 'Drupal\views_ui\ViewPreviewFormController',
      'clone' => 'Drupal\views_ui\ViewCloneFormController',
    ),
  );
}

It enhances the definition of the 'view' entity type with its default values.

It is not an alter, as it shouldn't get in the way of any contrib or custom modules who want to alter this.

Proposed resolution

Rename hook_entity_info() to hook_entity_info_build().

Remaining tasks

User interface changes

N/A

API changes

The new-style hook_entity_info() will be renamed, but that was already an API change from D7 (takes $entity_info by reference)

#1981312: Move views_ui code out of the View entity type annotation

AttachmentSizeStatusTest resultOperations
entity-info.patch4.53 KBIdlePASSED: [[SimpleTest]]: [MySQL] 55,622 pass(es).View details | Re-test

Viewing all articles
Browse latest Browse all 293443

Trending Articles