diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2012-09-30 20:37:55 -0400 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2012-09-30 20:37:55 -0400 |
commit | 13f16ae3423087824118e1e5c07f88396a85c8f7 (patch) | |
tree | 7a9678d7256d44fdcd4d5580a548ffca98aa7459 /modules/system/system.api.php | |
parent | c3cba0532ba45692af5378d1b89e745ea0df3701 (diff) | |
download | brdo-13f16ae3423087824118e1e5c07f88396a85c8f7.tar.gz brdo-13f16ae3423087824118e1e5c07f88396a85c8f7.tar.bz2 |
Issue #1154382 by Berdir, barraponto, acouch, swentel, LoMo, DamienMcKenna, chx: Fixed View mode no longer can be changed.
Diffstat (limited to 'modules/system/system.api.php')
-rw-r--r-- | modules/system/system.api.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/system/system.api.php b/modules/system/system.api.php index dda62f7ac..7bf637ec0 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -466,6 +466,24 @@ function hook_entity_view_alter(&$build, $type) { } /** + * Change the view mode of an entity that is being displayed. + * + * @param string $view_mode + * The view_mode that is to be used to display the entity. + * @param array $context + * Array with contextual information, including: + * - entity_type: The type of the entity that is being viewed. + * - entity: The entity object. + * - langcode: The langcode the entity is being viewed in. + */ +function hook_entity_view_mode_alter(&$view_mode, $context) { + // For nodes, change the view mode when it is teaser. + if ($context['entity_type'] == 'node' && $view_mode == 'teaser') { + $view_mode = 'my_custom_view_mode'; + } +} + +/** * Define administrative paths. * * Modules may specify whether or not the paths they define in hook_menu() are |