Forum Discussion

nicgutierrez's avatar
11 years ago

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

3 Replies

  • NicoB's avatar
    NicoB
    Lithium Alumni (Retired)
    11 years ago

    Hi,

    can you try and replace this

     <#assign boards = env.context.component.getParameter( 'boards' ) />

     with this

    <#assign boards = env.context.component.getParameter( 'boards' )!("") />
     <#if !(boards?? && boards?has_content)>
       <#assign boards = restadmin( '/categories/id/' + category.id + '/boards/style/forum/nested' ).boards />
     </#if>
    
    

     and see whether it fixes the issue?

     

    Thanks,

     

    Nico

  • nicgutierrez - We reported this issue to Lithium earlier and heard back today that it has been fixed in version 14.9. This was a known issue in case of Custom Components but worked fine in Endpoints. Could you please check your community version?
  • nicgutierrez's avatar
    nicgutierrez
    Ace
    11 years ago

    Hi Both.

    Thanks for your help.


    The version we are currently using is 14.8: we have just requested to updated to 14.9.

    Regards.
    Nic