1 entity.api.php hook_entity_view_mode_delete($view_mode, $entity_type)

Respond to deletion of a display mode.

Parameters

string $view_mode: The display mode that is to be used to display the entity.

$entity_type: The type of entity being saved (i.e. node, user, comment).

Related topics

File

core/modules/entity/entity.api.php, line 569
Hooks provided by the Entity module.

Code

function hook_entity_view_mode_delete($view_mode, $entity_type) {
  $config = config('my_module.view_modes');
  $view_mode_list = $config->get('view_mode_list');
  unset($view_mode_list[$view_mode['machine_name']]);
  $config->set('view_mode_list', $view_mode_list);
  $config->save();
}