function social_landing_page_preprocess_field in Open Social 8.6
Same name and namespace in other branches
- 8.9 modules/social_features/social_landing_page/social_landing_page.module \social_landing_page_preprocess_field()
- 8.2 modules/social_features/social_landing_page/social_landing_page.module \social_landing_page_preprocess_field()
- 8.3 modules/social_features/social_landing_page/social_landing_page.module \social_landing_page_preprocess_field()
- 8.4 modules/social_features/social_landing_page/social_landing_page.module \social_landing_page_preprocess_field()
- 8.5 modules/social_features/social_landing_page/social_landing_page.module \social_landing_page_preprocess_field()
- 8.7 modules/social_features/social_landing_page/social_landing_page.module \social_landing_page_preprocess_field()
- 8.8 modules/social_features/social_landing_page/social_landing_page.module \social_landing_page_preprocess_field()
- 10.3.x modules/social_features/social_landing_page/social_landing_page.module \social_landing_page_preprocess_field()
- 10.0.x modules/social_features/social_landing_page/social_landing_page.module \social_landing_page_preprocess_field()
- 10.1.x modules/social_features/social_landing_page/social_landing_page.module \social_landing_page_preprocess_field()
- 10.2.x modules/social_features/social_landing_page/social_landing_page.module \social_landing_page_preprocess_field()
Implements hook_preprocess_HOOK().
File
- modules/
social_features/ social_landing_page/ social_landing_page.module, line 226 - The Social landing page module.
Code
function social_landing_page_preprocess_field(&$variables) {
if ($variables['field_name'] === 'field_button_link_an' || $variables['field_name'] === 'field_button_link_lu') {
$entity = $variables['element']['#object'];
$button_style = $entity->field_button_style->value;
foreach ($variables['items'] as $key => $value) {
if (isset($variables['items'][$key]['content'])) {
$variables['items'][$key]['content']['#options']['attributes'] = [
'class' => 'btn btn-lg ' . $button_style,
];
}
}
}
}