function PreprocessHooks::preprocessDescriptionToggle
Same name and namespace in other branches
- main core/themes/admin/src/Hook/PreprocessHooks.php \Drupal\admin\Hook\PreprocessHooks::preprocessDescriptionToggle()
Generic preprocess enabling toggle.
Parameters
array $variables: The variables array (modify in place).
4 calls to PreprocessHooks::preprocessDescriptionToggle()
- PreprocessHooks::datetimeWrapper in core/
themes/ admin/ src/ Hook/ PreprocessHooks.php - Implements hook_preprocess_HOOK() for datetime_wrapper.
- PreprocessHooks::details in core/
themes/ admin/ src/ Hook/ PreprocessHooks.php - Implements hook_preprocess_HOOK() for details.
- PreprocessHooks::fieldset in core/
themes/ admin/ src/ Hook/ PreprocessHooks.php - Implements hook_preprocess_HOOK() for fieldset.
- PreprocessHooks::formElement in core/
themes/ admin/ src/ Hook/ PreprocessHooks.php - Implements hook_preprocess_HOOK() for form_element.
File
-
core/
themes/ admin/ src/ Hook/ PreprocessHooks.php, line 1511
Class
- PreprocessHooks
- Provides preprocess implementations.
Namespace
Drupal\admin\HookCode
private function preprocessDescriptionToggle(array &$variables) : void {
$isEnabled = Settings::getInstance()->get('show_description_toggle') && Helper::isContentForm();
if (isset($variables['element']['#description_toggle']) && $variables['element']['#description_toggle'] || $isEnabled) {
if (!empty($variables['description'])) {
$variables['description_display_toggle'] = $variables['description_display'] ?? 'after';
$variables['description_display'] = 'invisible';
$variables['description_toggle'] = TRUE;
}
elseif (!empty($variables['element']['#description_toggle'])) {
$variables['description_toggle'] = TRUE;
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.