Embedded blocks following upgrade to v9.5.1

I had a hard-coded autonav for breadcrumbs and page_list for sub navigation in my v8 theme templates. These were both using custom templates in the application/blocks override directories and had been working as expected following the upgrade to v9.

Following the upgrade from 9.4.8 to 9.5.1 the blocks are no longer displayed on the page. Checking the logs it seems the custom templates are no longer recognised from the application/blocks directory but rather looking in the updates/concrete-cms-9.5.1-remote-updater directory instead.

I have temporarily fixed this by copying the relevant templates into the updates folder but this will obviously break again following any future updates. Is this a bug in the 9.5.1 update or is this a deprecated feature with an alternative implementation for v9?

I checked the v9 documentation but cannot find anything related to embedding blocks manually with a custom template defined in the render statement.

Any suggestions would be greatly appreciated.

The embed code would probably be helpful too…

$bt = BlockType::getByHandle('autonav');
$bt->controller->orderBy = 'display_asc';
$bt->controller->displayPages = 'second_level';
$bt->controller->displaySubPages = 'relevant_breadcrumb';
$bt->controller->displaySubPageLevels = 'custom';
$bt->controller->displaySubPageLevelsNum = '2';
$bt->render('templates/section'); 

Try clearing your cache and your browser cache.

Hard coded navigation is generally not good for performance because the blocks don’t cache (unless you write further code).

You could take this as an opportunity to replace them with real blocks and loose the overhead of maintaining the code.

Thank you ConcreteOwl - I did try clearing the site cache and using a different browser incognito window to bypass local browser cache but this did not fix this issue. Thanks for the suggestion.

Thank you JohntheFish. I had these set up on a few older themes but it looks like I would be better following your advice and getting these updated in the long run. I suspect new global areas for these template types will be the solution. Thanks for your input, much appreciated.

Thinking further on your original post, the custom page template recognition may be another manifestation of a bug introduced in v9.5.0. There has been similar issues with custom and packaged block template and element resolution, where the core was not looking in the right places and fell back on default templates.

I can confirm this issue. We use the following code in our template and it displays nothing after updating from 9.4.8 to 9.5.1.

						$navColPage = Page::getByID('173');
						$targetMs = MultilingualSection::getByLocale($locale);
						$relatedPage = Page::getByID($targetMs->getTranslatedPageID($navColPage));
						$nav_1 = BlockType::getByHandle('autonav');
						$nav_1->controller->orderBy = 'display_asc';
						$nav_1->controller->displayPages = 'custom';
						$nav_1->controller->displayPagesCID = $relatedPage->cID;
						$nav_1->controller->displaySubPages = 'all';
						$nav_1->controller->displaySubPageLevels = 'enough';
						$nav_1->controller->displaySubPageLevelsNum = 0;
						$nav_1->controller->displayUnavailablePages = 0;
						$nav_1->controller->navArray = array();
						$nav_1->render('templates/menu_fullwidth_cols');

Please open an issue on GitHub. Issues · concretecms/concretecms · GitHub

I just wanted to share a temporary workaround that worked for me.

I replaced my render function:

$nav_1->render('templates/menu_fullwidth_cols');

with including the absolute path after pointing to the controller:

$controller = $nav_1->controller;
include(DIR_APPLICATION . '/blocks/autonav/templates/menu_fullwidth_cols/view.php');

This is obviously not a proper fix, since it bypasses the normal rendering process, but it may help as a temporary solution until a real fix is available.

Thanks for the reminder JohntheFish - I have just opened an issue for this.

Thank you for the suggestion Vuish - certainly a more robust solution than copying custom template files into the updates directory!

Following JohntheFish’s advice regarding caching and performance, I have now replaced the embedded block with a global area and added the block with custom templates there instead.