public function GroupSettingsHelp::preprocessVariables in Open Social 8.9
Same name and namespace in other branches
- 8.6 themes/socialbase/src/Plugin/Preprocess/GroupSettingsHelp.php \Drupal\socialbase\Plugin\Preprocess\GroupSettingsHelp::preprocessVariables()
- 8.7 themes/socialbase/src/Plugin/Preprocess/GroupSettingsHelp.php \Drupal\socialbase\Plugin\Preprocess\GroupSettingsHelp::preprocessVariables()
- 8.8 themes/socialbase/src/Plugin/Preprocess/GroupSettingsHelp.php \Drupal\socialbase\Plugin\Preprocess\GroupSettingsHelp::preprocessVariables()
Preprocess the variables array.
Parameters
\Drupal\bootstrap\Utility\Variables $variables: The Variables object.
Overrides PreprocessBase::preprocessVariables
File
- themes/
socialbase/ src/ Plugin/ Preprocess/ GroupSettingsHelp.php, line 26
Class
- GroupSettingsHelp
- Pre-processes variables for the "group_settings_help" theme hook.
Namespace
Drupal\socialbase\Plugin\PreprocessCode
public function preprocessVariables(Variables $variables) {
$build = [];
$unique_id = Html::getUniqueId('group-settings-help');
$icon = Bootstrap::glyphicon('info-sign');
$build['toggle'] = [
'#type' => 'link',
'#title' => '',
'#url' => Url::fromUserInput("#{$unique_id}"),
'#icon' => $icon,
'#attributes' => [
'class' => [
'icon-before',
],
'data-toggle' => 'popover',
'data-html' => 'true',
'data-placement' => 'bottom',
'data-title' => $variables['group_type'],
],
];
$build['settings'] = [
'#type' => 'container',
'#theme_wrappers' => [
'container__group_settings_help',
],
];
$build['settings']['join_method'] = [
'#theme' => 'item_list__group_settings_help',
'#items' => $variables['join_method'],
'#title' => $this
->t('Method to join'),
];
$build['settings']['allowed_visibility'] = [
'#theme' => 'item_list__group_settings_help',
'#items' => $variables['allowed_visibility'],
'#title' => $this
->t('Content visibility'),
];
$variables['popover'] = $build;
$variables['popover_id'] = $unique_id;
$variables['popover_toggle'] = $build['toggle'];
$variables['popover_info'] = $build['settings'];
}