Create View modes programtically
/**
* Implements hook_entity_info_alter().
*
* Set up view modes as an array.
*/
function dev_patterns_entity_info_alter(&$entity_info) {
// Node display modes.
$entity_info['node']['view modes'] += [
'person_tile' => [
'label' => t('Person Tile'),
'custom settings' => FALSE,
],
'3up_card' => [
'label' => t('3-Up Card'),
'custom settings' => FALSE,
],
'hero' => [
'label' => t('Hero'),
'custom settings' => FALSE,
],
];
}Other view modes:
Last updated
Was this helpful?