2 * Implements hook_field_display_alter().
4 function {{ machine_name }}_field_display_alter(&$display, $context) {
5 // Leave field labels out of the search index.
6 // Note: The check against $context['entity_type'] == 'node' could be avoided
7 // by using hook_field_display_node_alter() instead of
8 // hook_field_display_alter(), resulting in less function calls when
9 // rendering non-node entities.
10 if ($context['entity_type'] == 'node' && $context['view_mode'] == 'search_index') {
11 $display['label'] = 'hidden';