hook_field_extra_fields_display_alter

function hook_field_extra_fields_display_alter

hook_field_extra_fields_display_alter(&$displays, $context)

Alters the display settings of pseudo-fields before an entity is displayed.

This hook is called once per displayed entity. If the result of the hook involves reading from the database, it is highly recommended to statically cache the information.

Parameters

$displays: An array of display settings for the pseudo-fields in the entity, keyed by pseudo-field names.

$context: An associative array containing:

  • entity_type: The entity type; e.g., 'node' or 'user'.
  • bundle: The bundle name.
  • view_mode: The view mode, e.g. 'full', 'teaser'...

Related topics

File

modules/field/field.api.php, line 2430
Hooks provided by the Field module.

Code

function hook_field_extra_fields_display_alter(&$displays, $context) {
  if ($context['entity_type'] == 'taxonomy_term' && $context['view_mode'] == 'full') {
    $displays['description']['visible'] = FALSE;
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!field!field.api.php/function/hook_field_extra_fields_display_alter/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部