Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 UTC on 18 March 2024, to get $100 off your ticket.
The example code within the hook uses 'visibility' key when the api seems to use 'visible'.
function hook_field_extra_fields_display_alter(&$displays, $context) {
if ($context['entity_type'] == 'taxonomy_term' && $context['view_mode'] == 'full') {
$displays['description']['visibility'] = FALSE;
}
}
Implementing the following:
function somemodule_field_extra_fields_display_alter(&$displays, $context) {
if ($context['entity_type'] == 'user' && $context['view_mode'] == 'display') {
$displays['summary']['visible'] = FALSE;
}
}
Is called, and changes the array as can be confirmed by running
debug(field_extra_fields_get_display('user', 'user', 'display'));
but when viewing a user/#/view page the history is still visible.
Comment | File | Size | Author |
---|---|---|---|
#2 | 1097972-hook-example-code.patch | 1.27 KB | boombatower |
Comments
Comment #1
boombatower CreditAttribution: boombatower commentedHeh, view_mode == 'full' should be the code. Only getting called since I was calling it bellow.
So only incorrect example code.
Comment #2
boombatower CreditAttribution: boombatower commentedAssume we start the 'ol commit to 8.x and backport to 7.x?
Comment #3
yched CreditAttribution: yched commentedCorrect.
Comment #4
Dries CreditAttribution: Dries commentedCommitted to my local repository. Will be pushed later today. Moving to D7.
Comment #5
webchickCommitted to 7.x. Thanks!