function social_group_flexible_group_preprocess_form_element in Open Social 10.1.x
Same name and namespace in other branches
- 10.3.x modules/social_features/social_group/modules/social_group_flexible_group/social_group_flexible_group.module \social_group_flexible_group_preprocess_form_element()
- 10.0.x modules/social_features/social_group/modules/social_group_flexible_group/social_group_flexible_group.module \social_group_flexible_group_preprocess_form_element()
- 10.2.x modules/social_features/social_group/modules/social_group_flexible_group/social_group_flexible_group.module \social_group_flexible_group_preprocess_form_element()
Implements template_preprocess_form_element().
File
- modules/
social_features/ social_group/ modules/ social_group_flexible_group/ social_group_flexible_group.module, line 376 - The Social Group Flexible Group module.
Code
function social_group_flexible_group_preprocess_form_element(&$variables) {
// Make sure our flexible group visibility field renders icons in the radio
// labels. We add a new property to the form element label render array.
// This is used in FormElementLabel.php to add data for templating.
if (!isset($variables['element']['#type'])) {
return;
}
if ($variables['element']['#type'] === 'radio' && !empty($variables['name']) && $variables['name'] === 'field_flexible_group_visibility') {
$variables['label']['#render_icon'] = TRUE;
$variables['attributes']['class'][] = 'inline-item';
}
if ($variables['element']['#type'] === 'checkbox' && !empty($variables['name']) && strpos($variables['name'], 'field_group_allowed_visibility') !== FALSE) {
$variables['label']['#render_icon'] = TRUE;
$variables['attributes']['class'][] = 'inline-item';
}
}