function ClaroHooks::preprocessDatetimeWrapper

Same name and namespace in other branches
  1. main core/themes/claro/src/Hook/ClaroHooks.php \Drupal\claro\Hook\ClaroHooks::preprocessDatetimeWrapper()

Implements hook_preprocess_HOOK() for datetime_wrapper.

Attributes

#[Hook('preprocess_datetime_wrapper')]

File

core/themes/claro/src/Hook/ClaroHooks.php, line 804

Class

ClaroHooks
Hook implementations for claro.

Namespace

Drupal\claro\Hook

Code

public function preprocessDatetimeWrapper(&$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');
    }
  }
}

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