Add a personalized presentation to an entity (view mode)

 * Implements hook_entity_info_alter().
function my_module_entity_info_alter(&$entity_info) {
  // Add new view mode to user entity.
  $entity_info['user']['view modes']['example'] = array(
    'label' => t('Example view mode for user entity'),
    'custom settings' => TRUE,

You can also alter the presentation (view mode) of an entity in it visualization.  I teach you how to do it in this snippet.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.