You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have installed the addon in a new Statamic 4 project.
There seems to be a problem injecting the IDs in the content headers.
Parser's injectIds function expects its first param $value to be a string or an array of strings (see preg_replace_callback).
When using Bard, $value is an array of \Statamic\Fields\Values objects.
I am not sure about the bast way to solve this, but I've tried this locally. I appreciate feedback.
/** * Injects id directives in header HTML elements. * @return string|array */publicfunctioninjectIds($value, $params = null)
{
// Handles an array (we could also check the type of the items in the array)if (is_array($value)) {
returnarray_map(function (Values$valueItem) use ($params) {
if ($valueItem['type'] === 'text') {
returnnewValues(
array_merge(
$valueItem->all(),
['text' => $this->getInjectedText($valueItem['text'], $params)]
)
);
}
return$valueItem;
}, $value);
}
return$this->getInjectedText($value, $params);
}
privatefunctiongetInjectedText(string$text, ?array$params): string
{
returnpreg_replace_callback(
...
);
}
The text was updated successfully, but these errors were encountered:
Hi there,
I have installed the addon in a new Statamic 4 project.
There seems to be a problem injecting the IDs in the content headers.
Parser's injectIds function expects its first param $value to be a string or an array of strings (see preg_replace_callback).
When using Bard, $value is an array of \Statamic\Fields\Values objects.
I am not sure about the bast way to solve this, but I've tried this locally. I appreciate feedback.
The text was updated successfully, but these errors were encountered: