All preprocess methods have three arguments, regardless of the context of what the method is for. An example is:
protected function preprocessElement(Variables $variables, $hook, array $info) {}

This should really just be:
protected function preprocessElement(Element $element, Variables $variables) {}

Any helper method can access $variables, $hook, $info by attaching them to the object itself, regardless of the method signature, like:

$this->variables
$this->variables->element // if it exists
$this->hook
$this->info

Comments

markcarver created an issue. See original summary.

markhalliwell’s picture

Issue summary: View changes

  • markcarver committed 010eb71 on 8.x-3.x
    Issue #2758045 by markcarver: Preprocess method signatures are...
markhalliwell’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.