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

Act on a display mode before it is created or updated.

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 527
Hooks provided by the Entity module.

Code

function hook_entity_view_mode_presave($view_mode, $entity_type) {
  // Force all display modes to be saved with custom settings.
  $view_mode['custom settings'] = TRUE;
  return $view_mode;
}