diff --git a/core/includes/entity.api.php b/core/includes/entity.api.php index 178f045..65725b6 100644 --- a/core/includes/entity.api.php +++ b/core/includes/entity.api.php @@ -40,7 +40,7 @@ function hook_entity_info(&$entity_info) { * @see hook_entity_view_mode_info() */ function hook_entity_view_mode_info_alter(&$view_modes) { - $view_modes['user']['full']['custom_settings'] = TRUE; + $view_modes['user']['full']['status'] = TRUE; } /** diff --git a/core/includes/entity.inc b/core/includes/entity.inc index b84fee4..b691db9 100644 --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -701,7 +701,7 @@ function entity_get_render_display(EntityInterface $entity, $view_mode) { // configuration of the view mode for this bundle, this will be either the // display associated to the view mode, or the 'default' display. $view_mode_settings = field_view_mode_settings($entity_type, $bundle); - $render_view_mode = !empty($view_mode_settings[$view_mode]['custom_settings']) ? $view_mode : 'default'; + $render_view_mode = !empty($view_mode_settings[$view_mode]['status']) ? $view_mode : 'default'; $display = entity_get_display($entity_type, $bundle, $render_view_mode); $display->originalViewMode = $view_mode; diff --git a/core/modules/block/custom_block/config/entity.view_mode.custom_block.full.yml b/core/modules/block/custom_block/config/entity.view_mode.custom_block.full.yml index bed1d89..8d346a2 100644 --- a/core/modules/block/custom_block/config/entity.view_mode.custom_block.full.yml +++ b/core/modules/block/custom_block/config/entity.view_mode.custom_block.full.yml @@ -1,5 +1,5 @@ id: custom_block.full label: Full -custom_settings: '0' +status: '0' targetEntityType: custom_block locked: '1' diff --git a/core/modules/book/config/entity.view_mode.node.print.yml b/core/modules/book/config/entity.view_mode.node.print.yml index 431abeb..621896b 100644 --- a/core/modules/book/config/entity.view_mode.node.print.yml +++ b/core/modules/book/config/entity.view_mode.node.print.yml @@ -1,5 +1,5 @@ id: node.print label: Print -custom_settings: '0' +status: '0' targetEntityType: node locked: '1' diff --git a/core/modules/comment/config/entity.view_mode.comment.full.yml b/core/modules/comment/config/entity.view_mode.comment.full.yml index 892da5c..1dd3383 100644 --- a/core/modules/comment/config/entity.view_mode.comment.full.yml +++ b/core/modules/comment/config/entity.view_mode.comment.full.yml @@ -1,5 +1,5 @@ id: comment.full label: Full comment -custom_settings: '0' +status: '0' targetEntityType: comment locked: '1' diff --git a/core/modules/entity/lib/Drupal/entity/EntityViewModeInterface.php b/core/modules/entity/lib/Drupal/entity/EntityViewModeInterface.php new file mode 100644 index 0000000..718479f --- /dev/null +++ b/core/modules/entity/lib/Drupal/entity/EntityViewModeInterface.php @@ -0,0 +1,17 @@ + $view_mode_info) { - if (!isset($settings[$view_mode]['custom_settings']) && $view_mode_info['custom_settings']) { - $settings[$view_mode]['custom_settings'] = TRUE; + if (!isset($settings[$view_mode]['status']) && $view_mode_info['status']) { + $settings[$view_mode]['status'] = TRUE; } } $cache[$entity_type][$bundle] = $settings; diff --git a/core/modules/field/tests/modules/field_test/field_test.entity.inc b/core/modules/field/tests/modules/field_test/field_test.entity.inc index d5b5e57..32f20b3 100644 --- a/core/modules/field/tests/modules/field_test/field_test.entity.inc +++ b/core/modules/field/tests/modules/field_test/field_test.entity.inc @@ -38,11 +38,11 @@ function field_test_entity_view_mode_info_alter(&$view_modes) { $view_modes[$entity_type] = array( 'full' => array( 'label' => t('Full object'), - 'custom_settings' => TRUE, + 'status' => TRUE, ), 'teaser' => array( 'label' => t('Teaser'), - 'custom_settings' => TRUE, + 'status' => TRUE, ), ); } diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module index 4ff2754..cce8734 100644 --- a/core/modules/field_ui/field_ui.module +++ b/core/modules/field_ui/field_ui.module @@ -5,7 +5,7 @@ * Allows administrators to attach custom fields to fieldable types. */ -use Drupal\entity\Plugin\Core\Entity\EntityViewMode; +use Drupal\entity\EntityViewModeInterface; /** * Implements hook_help(). @@ -354,14 +354,13 @@ function field_ui_library_info() { /** * Implements hook_view_mode_presave(). */ -function field_ui_view_mode_presave(EntityViewMode $view_mode) { +function field_ui_view_mode_presave(EntityViewModeInterface $view_mode) { state()->set('menu_rebuild_needed', TRUE); } /** * Implements hook_view_mode_delete(). */ -function field_ui_view_mode_delete(EntityViewMode $view_mode) { +function field_ui_view_mode_delete(EntityViewModeInterface $view_mode) { state()->set('menu_rebuild_needed', TRUE); } - diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Access/ViewModeAccessCheck.php b/core/modules/field_ui/lib/Drupal/field_ui/Access/ViewModeAccessCheck.php index 640ae84..1ddb8b5 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Access/ViewModeAccessCheck.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Access/ViewModeAccessCheck.php @@ -32,7 +32,7 @@ public function access(Route $route, Request $request) { $view_mode = $request->attributes->get('view_mode'); $view_mode_settings = field_view_mode_settings($entity_type, $bundle); - $visibility = ($view_mode == 'default') || !empty($view_mode_settings[$view_mode]['custom_settings']); + $visibility = ($view_mode == 'default') || !empty($view_mode_settings[$view_mode]['status']); if ($visibility) { $permission = $route->getRequirement('_field_ui_view_mode_access'); return user_access($permission); diff --git a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php index cf4f6de..f8c440b 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php @@ -361,7 +361,7 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL, $view_mode_settings = field_view_mode_settings($this->entity_type, $this->bundle); foreach ($view_modes as $view_mode_name => $view_mode_info) { $options[$view_mode_name] = $view_mode_info['label']; - if (!empty($view_mode_settings[$view_mode_name]['custom_settings'])) { + if (!empty($view_mode_settings[$view_mode_name]['status'])) { $default[] = $view_mode_name; } } @@ -476,7 +476,7 @@ public function submitForm(array &$form, array &$form_state) { $view_mode_settings = field_view_mode_settings($this->entity_type, $this->bundle); foreach ($form_values['view_modes_custom'] as $view_mode => $value) { - if (!empty($value) && empty($view_mode_settings[$view_mode]['custom_settings'])) { + if (!empty($value) && empty($view_mode_settings[$view_mode]['status'])) { // If no display exists for the newly enabled view mode, initialize // it with those from the 'default' view mode, which were used so // far. @@ -489,7 +489,7 @@ public function submitForm(array &$form, array &$form_state) { $path = $this->entityManager->getAdminPath($this->entity_type, $this->bundle) . "/display/$view_mode"; drupal_set_message(t('The %view_mode mode now uses custom display settings. You might want to configure them.', array('%view_mode' => $view_mode_label, '@url' => url($path)))); } - $bundle_settings['view_modes'][$view_mode]['custom_settings'] = !empty($value); + $bundle_settings['view_modes'][$view_mode]['status'] = !empty($value); } // Save updated bundle settings. diff --git a/core/modules/file/config/entity.view_mode.file.full.yml b/core/modules/file/config/entity.view_mode.file.full.yml index f6c2096..4852de7 100644 --- a/core/modules/file/config/entity.view_mode.file.full.yml +++ b/core/modules/file/config/entity.view_mode.file.full.yml @@ -1,5 +1,5 @@ id: file.full label: File default -custom_settings: '0' +status: '0' targetEntityType: file locked: '1' diff --git a/core/modules/node/config/entity.view_mode.node.full.yml b/core/modules/node/config/entity.view_mode.node.full.yml index 6af61fc..aabb62e 100644 --- a/core/modules/node/config/entity.view_mode.node.full.yml +++ b/core/modules/node/config/entity.view_mode.node.full.yml @@ -1,5 +1,5 @@ id: node.full label: Full content -custom_settings: '0' +status: '0' targetEntityType: node locked: '1' diff --git a/core/modules/node/config/entity.view_mode.node.rss.yml b/core/modules/node/config/entity.view_mode.node.rss.yml index 755f92c..62bf8f7 100644 --- a/core/modules/node/config/entity.view_mode.node.rss.yml +++ b/core/modules/node/config/entity.view_mode.node.rss.yml @@ -1,5 +1,5 @@ id: node.rss label: RSS -custom_settings: '0' +status: '0' targetEntityType: node locked: '1' diff --git a/core/modules/node/config/entity.view_mode.node.teaser.yml b/core/modules/node/config/entity.view_mode.node.teaser.yml index 0400376..a604a3c 100644 --- a/core/modules/node/config/entity.view_mode.node.teaser.yml +++ b/core/modules/node/config/entity.view_mode.node.teaser.yml @@ -1,5 +1,5 @@ id: node.teaser label: Teaser -custom_settings: '1' +status: '1' targetEntityType: node locked: '1' diff --git a/core/modules/search/config/entity.view_mode.node.search_index.yml b/core/modules/search/config/entity.view_mode.node.search_index.yml index 85bd27f..eed60ff 100644 --- a/core/modules/search/config/entity.view_mode.node.search_index.yml +++ b/core/modules/search/config/entity.view_mode.node.search_index.yml @@ -1,5 +1,5 @@ id: node.search_index label: Search index -custom_settings: '0' +status: '0' targetEntityType: node locked: '1' diff --git a/core/modules/search/config/entity.view_mode.node.search_result.yml b/core/modules/search/config/entity.view_mode.node.search_result.yml index f023ad7..fe7f028 100644 --- a/core/modules/search/config/entity.view_mode.node.search_result.yml +++ b/core/modules/search/config/entity.view_mode.node.search_result.yml @@ -1,5 +1,5 @@ id: node.search_result label: Search result -custom_settings: '0' +status: '0' targetEntityType: node locked: '1' diff --git a/core/modules/system/system.install b/core/modules/system/system.install index d0675e4..35529f0 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -2181,13 +2181,13 @@ function system_update_8056() { foreach ($entity_view_modes as $entity_type => $view_modes) { foreach ($view_modes as $key => $name) { - $custom_settings = in_array($key, array('teaser', 'compact')); - config("view_mode.$entity_type.$key") + $status = in_array($key, array('teaser', 'compact')); + config("entity.view_mode.$entity_type.$key") ->set('id', "$entity_type.$key") ->set('label', $name) ->set('targetEntityType', $entity_type) ->set('locked', TRUE) - ->set('custom_settings', $custom_settings) + ->set('status', $status) ->save(); } } diff --git a/core/modules/system/tests/modules/entity_test/config/entity.view_mode.entity_test_render.full.yml b/core/modules/system/tests/modules/entity_test/config/entity.view_mode.entity_test_render.full.yml index 874aebe..e599269 100644 --- a/core/modules/system/tests/modules/entity_test/config/entity.view_mode.entity_test_render.full.yml +++ b/core/modules/system/tests/modules/entity_test/config/entity.view_mode.entity_test_render.full.yml @@ -1,5 +1,5 @@ id: entity_test_render.full label: Full -custom_settings: '0' +status: '0' targetEntityType: entity_test_render locked: '1' diff --git a/core/modules/system/tests/modules/entity_test/config/entity.view_mode.entity_test_render.test.yml b/core/modules/system/tests/modules/entity_test/config/entity.view_mode.entity_test_render.test.yml index 724255f..05ec0bc 100644 --- a/core/modules/system/tests/modules/entity_test/config/entity.view_mode.entity_test_render.test.yml +++ b/core/modules/system/tests/modules/entity_test/config/entity.view_mode.entity_test_render.test.yml @@ -1,5 +1,5 @@ id: entity_test_render.test label: Test -custom_settings: '0' +status: '0' targetEntityType: entity_test_render locked: '1' diff --git a/core/modules/system/tests/upgrade/drupal-7.field.database.php b/core/modules/system/tests/upgrade/drupal-7.field.database.php index 9434c7c..48950aa 100644 --- a/core/modules/system/tests/upgrade/drupal-7.field.database.php +++ b/core/modules/system/tests/upgrade/drupal-7.field.database.php @@ -12,19 +12,19 @@ $value = array( 'view_modes' => array( 'teaser' => array( - 'custom_settings' => 1, + 'status' => 1, ), 'full' => array( - 'custom_settings' => 0, + 'status' => 0, ), 'rss' => array( - 'custom_settings' => 0, + 'status' => 0, ), 'search_index' => array( - 'custom_settings' => 0, + 'status' => 0, ), 'search_result' => array( - 'custom_settings' => 0, + 'status' => 0, ), ), 'extra_fields' => array( diff --git a/core/modules/taxonomy/config/entity.view_mode.taxonomy_term.full.yml b/core/modules/taxonomy/config/entity.view_mode.taxonomy_term.full.yml index 63c16d7..4dbd78b 100644 --- a/core/modules/taxonomy/config/entity.view_mode.taxonomy_term.full.yml +++ b/core/modules/taxonomy/config/entity.view_mode.taxonomy_term.full.yml @@ -1,5 +1,5 @@ id: taxonomy_term.full label: Taxonomy term page -custom_settings: '0' +status: '0' targetEntityType: taxonomy_term locked: '1' diff --git a/core/modules/taxonomy/config/entity.view_mode.taxonomy_vocabulary.full.yml b/core/modules/taxonomy/config/entity.view_mode.taxonomy_vocabulary.full.yml index 69d2386..f84e9b3 100644 --- a/core/modules/taxonomy/config/entity.view_mode.taxonomy_vocabulary.full.yml +++ b/core/modules/taxonomy/config/entity.view_mode.taxonomy_vocabulary.full.yml @@ -1,5 +1,5 @@ id: vocabulary.full label: Taxonomy vocabulary -custom_settings: '0' +status: '0' targetEntityType: taxonomy_vocabulary locked: '1' diff --git a/core/modules/user/config/entity.view_mode.user.compact.yml b/core/modules/user/config/entity.view_mode.user.compact.yml index 5f85374..58f0696 100644 --- a/core/modules/user/config/entity.view_mode.user.compact.yml +++ b/core/modules/user/config/entity.view_mode.user.compact.yml @@ -1,5 +1,5 @@ id: user.compact label: Compact -custom_settings: '1' +status: '1' targetEntityType: user locked: '1' diff --git a/core/modules/user/config/entity.view_mode.user.full.yml b/core/modules/user/config/entity.view_mode.user.full.yml index d3880a1..486ebc7 100644 --- a/core/modules/user/config/entity.view_mode.user.full.yml +++ b/core/modules/user/config/entity.view_mode.user.full.yml @@ -1,5 +1,5 @@ id: user.full label: User account -custom_settings: '0' +status: '0' targetEntityType: user locked: '1'