Problem/Motivation
An error occurs when displaying a node that has a paragraphs structure.
Steps to reproduce
If the $original variable is an array, we get this error.
In my case, the variable was:
Array
(
[0] => [paragraph:field_menu_type:value]
[1] => [paragraph:field_menu_type:value]
)
This data comes from linked_field custom link, based on something like this:
/node/[current-page:node:nid]/[paragraph:field_menu_type:value]?type=[paragraph:field_title_alt:value|paragraph:field_menu_type:value]
Maybe the problem is caused by
linked_field →
and I will take a look.
But the site wasn't breaking until ECA was installed, so maybe this $original variable should be protected against other types:
in src/Token/TokenDecoratorTrait.php line 336
if (1 === $this->recursionLevel) {
foreach ($tokens as $name => $original) {
$token_event = new TokenGenerateEvent($type, $name, $original, $data, $options, $bubbleable_metadata);
$this->eventDispatcher->dispatch($token_event, EcaEvents::TOKEN);
$data = $token_event->getData() + $data;
}
}