Jump to content

sidebar hook


techwthquestion

Recommended Posts

Hello brian,

Yes, I am using customer theme. I managed to created 2nd  box with text but I am not sure how to take input from viewticket.tpl. 

In the viewticket.tpl file, there is a code to fetch data Ticket, Subject, status, last update. .

But how can I use that in the hook?  Here is my code 

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar)
{
   if (APP::getCurrentFileName()=="viewticket"){

       $secondarySidebar->addChild('sidebar1', array(
               'label' => 'Ticket Information',
               'order' => '10',
               'icon' => 'fa-ticket"'
       ));
       $secondarySidebar->getChild('sidebar1')
               ->addChild('child1', array(
               'label' => 'Department',
               'uri' => 'http://www.google.com'
       ));        
$secondarySidebar->getChild('sidebar1')
               ->addChild('child2', array(
               'label' => 'Submitted',
               'uri' => 'http://www.google.com'
       ));        
$secondarySidebar->getChild('sidebar1')
               ->addChild('child3', array(
               'label' => 'Last Updated',
               'uri' => 'http://www.google.com'
       ));        
       

And here is the code from viewticket.tpl 

<h3 class="panel-title">
                <i class="fas fa-pencil-alt"></i> &nbsp; {$_ticketContainer.subject}
                <small style="float:right;">Created: {$_ticketContainer.dateline}&nbsp;&nbsp;&nbsp;&nbsp;Updated: {$_ticketContainer.lastactivity}</small>
            </h3>

<div class="date">
                {$_ticketPost.posttitle}
</div>

<span class="name">
                    {$_ticketPost.fullname}
 </span>

{$_ticket.department}

{$_ticket.status}

 

Edited by techwthquestion
Link to comment
Share on other sites

19 hours ago, techwthquestion said:

Yes, I am using customer theme.

the reason why I asked was because the templates/theme don't create the default sidebars - they should already exist and be visible when using Six (check if they are)... if your theme isn't showing them, but Six is, then that implies that the custom templates are not outputting the sidebar arrays correctly (or something is suppressing these sidebars)... or maybe Kayako doesn't use them.

19 hours ago, techwthquestion said:

I managed to created 2nd  box with text but I am not sure how to take input from viewticket.tpl

you might be able to access it via the Smarty array as per your other hook thread...

19 hours ago, techwthquestion said:

In the viewticket.tpl file, there is a code to fetch data Ticket, Subject, status, last update... But how can I use that in the hook?

a blind, but educated, guess would be...

GLOBAL $smarty;
$department = $smarty->getTemplateVars()['_ticket.department'];

and then...

'label' => 'Department: '.$department,
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