public function renderForQuicksand()
 {
     parent::willRenderPage();
     $response = $this->renderPageBodyContent();
     $response = $this->willSendResponse($response);
     $extra_config = $this->getQuicksandConfig();
     return array('content' => hsprintf('%s', $response)) + $this->buildQuicksandConfig() + $extra_config;
 }
 protected function willRenderPage()
 {
     parent::willRenderPage();
     if (!$this->getRequest()) {
         throw new Exception(pht('You must set the Request to render a PhabricatorStandardPageView.'));
     }
     $console = $this->getConsole();
     require_celerity_resource('phabricator-core-css');
     require_celerity_resource('phabricator-zindex-css');
     require_celerity_resource('phui-button-css');
     require_celerity_resource('phui-spacing-css');
     require_celerity_resource('phui-form-css');
     require_celerity_resource('sprite-gradient-css');
     require_celerity_resource('phabricator-standard-page-view');
     Javelin::initBehavior('workflow', array());
     $request = $this->getRequest();
     $user = null;
     if ($request) {
         $user = $request->getUser();
     }
     if ($user) {
         $default_img_uri = celerity_get_resource_uri('rsrc/image/icon/fatcow/document_black.png');
         $download_form = phabricator_form($user, array('action' => '#', 'method' => 'POST', 'class' => 'lightbox-download-form', 'sigil' => 'download'), phutil_tag('button', array(), pht('Download')));
         Javelin::initBehavior('lightbox-attachments', array('defaultImageUri' => $default_img_uri, 'downloadForm' => $download_form));
     }
     Javelin::initBehavior('aphront-form-disable-on-submit');
     Javelin::initBehavior('toggle-class', array());
     Javelin::initBehavior('konami', array());
     Javelin::initBehavior('history-install');
     Javelin::initBehavior('phabricator-gesture');
     $current_token = null;
     if ($user) {
         $current_token = $user->getCSRFToken();
     }
     Javelin::initBehavior('refresh-csrf', array('tokenName' => AphrontRequest::getCSRFTokenName(), 'header' => AphrontRequest::getCSRFHeaderName(), 'current' => $current_token));
     Javelin::initBehavior('device');
     if ($user->hasSession()) {
         $hisec = $user->getSession()->getHighSecurityUntil() - time();
         if ($hisec > 0) {
             $remaining_time = phutil_format_relative_time($hisec);
             Javelin::initBehavior('high-security-warning', array('uri' => '/auth/session/downgrade/', 'message' => pht('Your session is in high security mode. When you ' . 'finish using it, click here to leave.', $remaining_time)));
         }
     }
     if ($console) {
         require_celerity_resource('aphront-dark-console-css');
         $headers = array();
         if (DarkConsoleXHProfPluginAPI::isProfilerStarted()) {
             $headers[DarkConsoleXHProfPluginAPI::getProfilerHeader()] = 'page';
         }
         if (DarkConsoleServicesPlugin::isQueryAnalyzerRequested()) {
             $headers[DarkConsoleServicesPlugin::getQueryAnalyzerHeader()] = true;
         }
         Javelin::initBehavior('dark-console', array('uri' => pht('Main Request'), 'selected' => $user ? $user->getConsoleTab() : null, 'visible' => $user ? (int) $user->getConsoleVisible() : true, 'headers' => $headers));
         // Change this to initBehavior when there is some behavior to initialize
         require_celerity_resource('javelin-behavior-error-log');
     }
     if ($user) {
         $viewer = $user;
     } else {
         $viewer = new PhabricatorUser();
     }
     $menu = id(new PhabricatorMainMenuView())->setUser($viewer);
     if ($this->getController()) {
         $menu->setController($this->getController());
     }
     if ($this->getApplicationMenu()) {
         $menu->setApplicationMenu($this->getApplicationMenu());
     }
     $this->menuContent = $menu->render();
 }