示例#1
0
 /**
  * Prepare configured and available page actions
  * @param BaseTemplate $tpl
  */
 protected function preparePageActions(BaseTemplate $tpl)
 {
     $title = $this->getTitle();
     // Reuse template data variable from SkinTemplate to construct page menu
     $menu = array();
     $actions = $tpl->data['content_navigation']['actions'];
     // empty placeholder for edit and photos which both require js
     if ($this->isAllowedPageAction('edit')) {
         $menu['edit'] = array('id' => 'ca-edit', 'text' => '', 'itemtitle' => $this->msg('mobile-frontend-pageaction-edit-tooltip'), 'class' => MinervaUI::iconClass('edit', 'element', 'hidden'));
     }
     if ($this->isAllowedPageAction('watch')) {
         $watchTemplate = array('id' => 'ca-watch', 'class' => MinervaUI::iconClass('watch', 'element', 'icon-32px watch-this-article hidden'));
         // standardise watch article into one menu item
         if (isset($actions['watch'])) {
             $menu['watch'] = array_merge($actions['watch'], $watchTemplate);
         } elseif (isset($actions['unwatch'])) {
             $menu['watch'] = array_merge($actions['unwatch'], $watchTemplate);
             $menu['watch']['class'] .= ' watched';
         } else {
             // placeholder for not logged in
             $menu['watch'] = $watchTemplate;
             // FIXME: makeLink (used by makeListItem) when no text is present defaults to use the key
             $menu['watch']['text'] = '';
             $menu['watch']['href'] = $this->getLoginUrl(array('returnto' => $title));
         }
     }
     $tpl->set('page_actions', $menu);
 }