public function FieldDropdown::preprocess in Open Social 8.4
Same name and namespace in other branches
- 8.9 themes/socialbase/src/Plugin/Preprocess/FieldDropdown.php \Drupal\socialbase\Plugin\Preprocess\FieldDropdown::preprocess()
- 8 themes/socialbase/src/Plugin/Preprocess/FieldDropdown.php \Drupal\socialbase\Plugin\Preprocess\FieldDropdown::preprocess()
- 8.2 themes/socialbase/src/Plugin/Preprocess/FieldDropdown.php \Drupal\socialbase\Plugin\Preprocess\FieldDropdown::preprocess()
- 8.3 themes/socialbase/src/Plugin/Preprocess/FieldDropdown.php \Drupal\socialbase\Plugin\Preprocess\FieldDropdown::preprocess()
- 8.5 themes/socialbase/src/Plugin/Preprocess/FieldDropdown.php \Drupal\socialbase\Plugin\Preprocess\FieldDropdown::preprocess()
- 8.6 themes/socialbase/src/Plugin/Preprocess/FieldDropdown.php \Drupal\socialbase\Plugin\Preprocess\FieldDropdown::preprocess()
- 8.7 themes/socialbase/src/Plugin/Preprocess/FieldDropdown.php \Drupal\socialbase\Plugin\Preprocess\FieldDropdown::preprocess()
- 8.8 themes/socialbase/src/Plugin/Preprocess/FieldDropdown.php \Drupal\socialbase\Plugin\Preprocess\FieldDropdown::preprocess()
Preprocess theme hook variables.
Parameters
array $variables: The variables array, passed by reference (modify in place).
string $hook: The name of the theme hook.
array $info: The theme hook info array.
Overrides PreprocessBase::preprocess
File
- themes/
socialbase/ src/ Plugin/ Preprocess/ FieldDropdown.php, line 19
Class
- FieldDropdown
- Pre-processes variables for the "dropdown" theme hook.
Namespace
Drupal\socialbase\Plugin\PreprocessCode
public function preprocess(array &$variables, $hook, array $info) {
parent::preprocess($variables, $hook, $info);
if (isset($variables['active']) && is_numeric($variables['active'])) {
$title = $variables['element'][$variables['active']]['#title'];
$selected_icon = _socialbase_get_visibility_icon($title);
}
$variables['selected_icon'] = isset($selected_icon) ? $selected_icon : '';
}