function public function PreprocessBase::preprocess

8.x-3.x PreprocessBase.php public PreprocessBase::preprocess(array &$variables, $hook, array $info)

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 PreprocessInterface::preprocess

Class

PreprocessBase
Base preprocess class used to build the necessary variables for templates.

Namespace

Drupal\bootstrap\Plugin\Preprocess

Source src/Plugin/Preprocess/PreprocessBase.php (line 41)

public function preprocess(array &$variables, $hook, array $info) {
  $this->hook = $hook;
  $this->info = $info;
  $this->variables = Variables::create($variables);
  if ($this->variables->element) {
    // Check for errors and set the "has_error" property flag.
    if (!$this->variables->element->hasProperty('has_error')) {
      $errors = $this->variables->element->getProperty('errors');
      $this->variables->element->setProperty('has_error', isset($errors) || ($this->variables->element->getProperty('required') && $this->theme->getSetting('forms_required_has_error')));
    }
    $this->preprocessElement($this->variables->element, $this->variables);
  }
  $this->preprocessVariables($this->variables);
}