function ClaroHooks::preprocessImageWidget

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

Implements hook_preprocess_HOOK() for image_widget.

Attributes

#[Hook('preprocess_image_widget')]

File

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

Class

ClaroHooks
Hook implementations for claro.

Namespace

Drupal\claro\Hook

Code

public function preprocessImageWidget(&$variables) : void {
  // This prevents image widget templates from rendering preview container
  // HTML to users that do not have permission to access these previews.
  // @todo Revisit in https://drupal.org/node/953034
  // @todo Revisit in https://drupal.org/node/3114318
  if (isset($variables['data']['preview']['#access']) && $variables['data']['preview']['#access'] === FALSE) {
    unset($variables['data']['preview']);
  }
  $this->fileAndImageWidgetHelper($variables);
}

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