Jump to content

How to access alert information from ClientAreaPage hook


ffeingol

Recommended Posts

Hello,

 

I'm trying to access the alerts (that are by default in the top/right of the six theme) from the ClientAreaPage hook. I'm pretty sure that they variables are available, but it's just not working for me. I'm looking in particular to access the severity of each alert, but all of the data would be nice.

 

Thanks in advance.

Link to comment
Share on other sites

i'm not sure what you want to do with the alert information, but if it's simpler for you to avoid using hooks, you can access them in the header.tpl template... it's just an array being outputted via a foreach loop.

 

                <div class="pull-right nav">
                   <a href="#" class="quick-nav" data-toggle="popover" id="accountNotifications" data-placement="bottom" title="{lang key="notifications"}"><i class="fa fa-info"></i> {$LANG.notifications} ({$clientAlerts|count})</a>
                   <div id="accountNotificationsContent" class="hidden">
                       {foreach $clientAlerts as $alert}
                           <div class="clientalert text-{$alert->getSeverity()}">{$alert->getMessage()}{if $alert->getLinkText()} <a href="{$alert->getLink()}" class="btn btn-xs btn-{$alert->getSeverity()}">{$alert->getLinkText()}</a>{/if}</div>
                       {foreachelse}
                           <div class="clientalert text-success"><i class="fa fa-check-square-o"></i> {$LANG.notificationsnone}</div>
                       {/foreach}
                   </div>
               </div>

Link to comment
Share on other sites

Hello,

 

Thank you. I had already discovered where it was in the template code. I'm trying to use Bootstrap badges (based on the severity of the alert) and it just seemed like it would be easier to do in PHP/hook code vs. template code. Worst case I'll do it in the template.

 

Thanks again

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated