1 entity.module entity_view_mode_exists($machine_name, $element, $form_state)

Helper function: checks if the display mode exists.

This callback is used as a machine_name element "exists" callback.

Parameters

string $machine_name: The machine name of the display mode to check for.

Return value

bool: Whether or not the machine name already exists.

See also

field_ui_view_mode_form().

File

core/modules/entity/entity.module, line 163
Entity API for handling entities like nodes or users.

Code

function entity_view_mode_exists($machine_name, $element, $form_state) {
  $entity_info = entity_get_info($element['#entity_type']);
  return !empty($entity_info['view modes'][$machine_name]);
}