Forum Discussion

raguv12ps's avatar
5 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>
  • 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

      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

        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>