Created
January 21, 2016 14:58
-
-
Save kalinchernev/bff5b13e04d15ed832e8 to your computer and use it in GitHub Desktop.
One of my favorite Drupal-specific interceptions: if you are a president ...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_field_group_pre_render(). | |
*/ | |
function cwt_biography_field_group_pre_render(&$element, $group, &$form) { | |
if ($node = menu_get_object('node')) { | |
if ($node->type == 'biography' && $role = field_get_items('node', $node, 'field_biography_role')) { | |
$role_term = taxonomy_term_load($role[0]['tid']); | |
$is_president = !$role_term ? FALSE : _commissioner_uuid_is('president', $role_term->uuid); | |
if ($is_president && $group->label == 'Responsibilities') { | |
$group->label = t('Role'); | |
$group->format_settings['instance_settings']['attributes'] = 'id="role"'; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment