Hello everyone,
I created a custom plugin with cms blocks. Everything works fine until now.
I want to transfer data from php to my custom block, can someone help me how to do it?
I create a Resolver in Core directory and inserted it in service.config. I made some testing but nothing is changed in frontend. I think resolver is loaded because if I remove one “use …” I can see in frontend error of trying to load resolver.
public function enrich(CmsSlotEntity $slot, ResolverContext $resolverContext, ElementDataCollection $result): void
{
$text = new TextStruct();
$slot->setData('$text');
$config = $slot->getFieldConfig()->get('content');
if (!$config) {
return;
}
if ($config->isMapped() && $resolverContext instanceof EntityResolverContext) {
$content = $this->resolveEntityValue($resolverContext->getEntity(), $config->getValue());
$text->setContent('test1');
}
if ($config->isStatic()) {
$text->setContent('test2');
}
//return 'test12';
echo ("");
var_dump('$text');
echo ("");
}
How can I debug in php resolver?
I tried var_dump but still nothing…
Thank you,
Florida