This widget could not be displayed - Variable
Hi all.
I'm working on a custom component and the error "This widget could not be displayed" appears - only for non-admin users - as soon as I try to print use a variable that I'm creating. Here's the code:
<#assign category = coreNode.ancestors[0] />
<#attempt>
<#assign boards = env.context.component.getParameter( 'boards' ) />
<#recover>
<#assign boards = restadmin( '/categories/id/' + category.id + '/boards/style/forum/nested' ).boards />
</#attempt>
<#assign selectTopicsColumns = boards.board?size />
<#if ( selectTopicsColumns > 6 )>
<#assign selectTopicsColumns = 6 />
</#if>
<div class="wrapper" id="topic-select">
<ul id="topic-select-breadcrumb">
<li><a href="${URLTo( '/custom/page/page-id/BrowseTopics' )}">All Topics</a></li>
<li>${category.title}</li>
</ul>
<div id="topic-select-title">
<h3>${coreNode.title}</h3>
<#if ( selectTopicsColumns == 6 )>Here is where the code is failing and the error is displayed.
Please, notice that the widget is working fine if you are logged in as administrator but is failing if you are logged in as normal user or if you are logged out.
Many thanks.
Nic