diff --git a/core/includes/entity.inc b/core/includes/entity.inc index b39552f..639c53d 100644 --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -92,7 +92,7 @@ function entity_get_info($entity_type = NULL) { 'custom settings' => FALSE, ); foreach (array_filter($view_mode['entityTypes']) as $key => $value) { - $entity_info[$key]['view modes'][$view_mode] = $definition; + $entity_info[$key]['view modes'][$view_mode['name']] = $definition; } } diff --git a/core/modules/view_mode/lib/Drupal/view_mode/Tests/ViewModeTest.php b/core/modules/view_mode/lib/Drupal/view_mode/Tests/ViewModeTest.php index c827e2b..141edb0 100644 --- a/core/modules/view_mode/lib/Drupal/view_mode/Tests/ViewModeTest.php +++ b/core/modules/view_mode/lib/Drupal/view_mode/Tests/ViewModeTest.php @@ -54,9 +54,9 @@ function setUp() { function createViewMode($edit = array()) { $edit += array( - 'machine_name' => 'Testing', + 'name' => 'Testing', 'label' => 'testing', - 'entity_types[node]' => '1' + 'entityTypes[node]' => '1' ); $this->drupalPost('admin/config/system/view-modes/add', $edit, 'Save'); @@ -70,8 +70,8 @@ function testManageViewModes() { $edit = array( 'label' => 'Testing', - 'machine_name' => 'testing', - 'entity_types[node]' => '1' + 'name' => 'testing', + 'entityTypes[node]' => '1' ); $this->createViewMode($edit); @@ -92,11 +92,11 @@ function testManageViewModes() { $edit = array( 'label' => 'Testing 2', ); - $this->drupalPost('admin/config/system/view-modes/edit/testing', $edit, 'Save'); + $this->drupalPost('admin/config/system/view-modes/testing/edit', $edit, 'Save'); $this->assertText('Saved the Testing 2 view mode.', 'Testing label updated'); // Remove a view mode. - $this->drupalPost('admin/config/system/view-modes/delete/testing', array(), 'Delete'); + $this->drupalPost('admin/config/system/view-modes/testing/delete', array(), 'Delete'); $this->assertText('Deleted the Testing 2 view mode', 'Deleted the Testing view mode'); // Assert the view mode is gone at the manage display screen. diff --git a/core/modules/view_mode/view_mode.module b/core/modules/view_mode/view_mode.module index 3f9a35e..a863aa6 100644 --- a/core/modules/view_mode/view_mode.module +++ b/core/modules/view_mode/view_mode.module @@ -67,3 +67,10 @@ function view_mode_menu() { function view_mode_load($machine_name) { return entity_load('view_mode', $machine_name); } + +/** + * Implements hook_view_mode_delete(). + */ +function view_mode_view_mode_delete($entity) { + entity_info_cache_clear(); +}