private function renderSearch()
 {
     $user = $this->user;
     $result = null;
     $keyboard_config = array('helpURI' => '/help/keyboardshortcut/');
     if ($user->isLoggedIn()) {
         $show_search = $user->isUserActivated();
     } else {
         $show_search = PhabricatorEnv::getEnvConfig('policy.allow-public');
     }
     if ($show_search) {
         $search = new PhabricatorMainMenuSearchView();
         $search->setUser($user);
         $application = null;
         $controller = $this->getController();
         if ($controller) {
             $application = $controller->getCurrentApplication();
         }
         if ($application) {
             $search->setApplication($application);
         }
         $result = $search;
         $pref_shortcut = PhabricatorUserPreferences::PREFERENCE_SEARCH_SHORTCUT;
         if ($user->loadPreferences()->getPreference($pref_shortcut, true)) {
             $keyboard_config['searchID'] = $search->getID();
         }
     }
     Javelin::initBehavior('phabricator-keyboard-shortcuts', $keyboard_config);
     if ($result) {
         $result = id(new PHUIListItemView())->addClass('phabricator-main-menu-search')->appendChild($result);
     }
     return $result;
 }
 private function renderSearch()
 {
     $viewer = $this->getViewer();
     $result = null;
     $keyboard_config = array('helpURI' => '/help/keyboardshortcut/');
     if ($viewer->isLoggedIn()) {
         $show_search = $viewer->isUserActivated();
     } else {
         $show_search = PhabricatorEnv::getEnvConfig('policy.allow-public');
     }
     if ($show_search) {
         $search = new PhabricatorMainMenuSearchView();
         $search->setViewer($viewer);
         $application = null;
         $controller = $this->getController();
         if ($controller) {
             $application = $controller->getCurrentApplication();
         }
         if ($application) {
             $search->setApplication($application);
         }
         $result = $search;
         $keyboard_config['searchID'] = $search->getID();
     }
     $keyboard_config['pht'] = array('/' => pht('Give keyboard focus to the search box.'), '?' => pht('Show keyboard shortcut help for the current page.'));
     Javelin::initBehavior('phabricator-keyboard-shortcuts', $keyboard_config);
     if ($result) {
         $result = id(new PHUIListItemView())->addClass('phabricator-main-menu-search')->appendChild($result);
     }
     return $result;
 }