return $this->getLayout() ->createBlock(CategoryBlock::class) ->setData([ 'title' => $title ? sprintf($title, $category->getName()) : null, 'category_id' => $category->getId(), 'description' => $description ? sprintf($description, $category->getName()) : null, ])->toHtml();The description is working by using $block->getDescription() as I would expect. The $block->getTitle() is not returning the value expected, instead it is return the number 1. Can anyone spot the problem as I have tried various things but it is not working. The project has to use 2.2.7 so need to debug in this version.
CategoryBlock::classe.g
Vendor\Module\Block\Name
Thanks for your help. It didn't resolve the problem so I had a deeper look in to the code.
The problem was caused by the previous developer returning $this->hasData('title') instead of $this->getData('title'); hence the value of 1 (true).