function PreprocessHooks::datetimeWrapper

Same name and namespace in other branches
  1. main core/themes/admin/src/Hook/PreprocessHooks.php \Drupal\admin\Hook\PreprocessHooks::datetimeWrapper()

Implements hook_preprocess_HOOK() for datetime_wrapper.

Attributes

#[Hook('preprocess_datetime_wrapper')]

File

core/themes/admin/src/Hook/PreprocessHooks.php, line 294

Class

PreprocessHooks
Provides preprocess implementations.

Namespace

Drupal\admin\Hook

Code

public function datetimeWrapper(array &$variables) : void {
  if (!empty($variables['element']['#errors'])) {
    $variables['title_attributes']['class'][] = 'has-error';
  }
  if (!empty($variables['element']['#disabled'])) {
    $variables['title_attributes']['class'][] = 'is-disabled';
    if (!empty($variables['description_attributes'])) {
      $variables['description_attributes']->addClass('is-disabled');
    }
  }
  $this->preprocessDescriptionToggle($variables);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.