5 August 2023

To define a new custom display for an entity in Drupal 7, you'll need to create a custom module and implement hook_entity_info_alter().

Source code viewer
  1. /**
  2.  * Implements hook_entity_info_alter().
  3.  */
  4. function HOOK_entity_info_alter(&$entity_info) {
  5. $entity_info['node']['view modes']['custom_display'] = array(
  6. 'label' => t('Custom Display'),
  7. 'custom settings' => TRUE,
  8. );
  9. }
Programming Language: PHP