Forum Discussion

raguv12ps's avatar
6 years ago

Display TKB widget through API

I am working on a custom component to display the TKB widget with id >sections.widget.sections-browser-taplet(For a particular category page) available under TKB section when creating custom page. 

The idea is to display the widget based on a few permissions. in custom component.

Is it possible to achieve this by using Rest API or any other way.

Any approaches are welcomed as we have a short time period to work on this. 

  • Parshant's avatar
    Parshant
    5 years ago

    raguv12ps,

    You just need to put that component in your custom component.

    Add conditions of user roles and add the widget under those conditions, something like below:

    <#assign hasRole = 'Administrator' />
    <#if hasRole == 'Administrator' >
    <@component id="common.widget.name" />
    </#if>

5 Replies

  • raguv12ps, Yes its possible to show this component using Roles permission API. API can give you the loggedin user roles, using the same you can check the role condition and show the Widget in custom component.

  • raguv12ps's avatar
    raguv12ps
    Ace
    5 years ago

    Parshant  I am able to fetch the roles of the logged in user, but not sure how I can show the TKB widget in custom component.

    Do we have any way to display the entire widget in custom component like the screenshot below. Currently the widget is added in my custom page and roles are configured for visibility for users.

     

  • Parshant's avatar
    Parshant
    Boss
    5 years ago

    raguv12ps,

    You just need to put that component in your custom component.

    Add conditions of user roles and add the widget under those conditions, something like below:

    <#assign hasRole = 'Administrator' />
    <#if hasRole == 'Administrator' >
    <@component id="common.widget.name" />
    </#if>
  • raguv12ps's avatar
    raguv12ps
    Ace
    5 years ago

    Parshant  I am able to display the widget using the component id.

    Thank you for the solution.

    One last question is that, can we display a custom page in another custom page similar to a widget using ID.

  • Parshant's avatar
    Parshant
    Boss
    5 years ago

    raguv12ps,

    Yes for sure,

    Select whether you want the new page to be nested within other pages.

    If you select the check box, the page will appear in the Custom Pages group in the components list in Studio > Page. You can drag and drop that page into another page. The Header and Footer components are examples of this feature. Note that the Custom Pages group only displays if you have created a custom page with Allow this page to be nested within other pages selected. A similar check box will appear in the Page tab when you view the custom page. You can change the setting in this view at any time.

    Click Create.

    The custom page now appears in the Page tab when you click the Choose link. The page will be in the Custom section.

    Now that you've made your custom quilt, you will need to know how to access it. You will need the direct URL for this page: http://community.domain/t5/custom/page/page-id/quilt-name-here. For example, if you named your custom page Test, then use would access the page using the URL http://your_community.khoros.com/t5/custom/page/page-id/Test.

     

    <component id="quilt:yourquiltname" wrapper="lia-page-wrapper"/>