/** * Executes the execute method of an action. * * @param sfAction $actionInstance An sfAction instance * * @return string The view type */ protected function executeAction($actionInstance) { $response = $actionInstance->getResponse(); // Set X-Frame-Options by default. Can be overridden by actions $response->setHttpHeader("X-Frame-Options", "DENY"); // execute the action $viewName = parent::executeAction($actionInstance); // Add form js and stylesheets to response if ($viewName != sfView::NONE) { $response->setHttpHeader('Expires', '0'); $response->setHttpHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0, max-age=0"); $response->setHttpHeader("Cache-Control", "private", false); $actionVars = $actionInstance->getVarHolder()->getAll(); foreach ($actionVars as $var) { if ($var instanceof sfForm) { foreach ($var->getStylesheets() as $file => $media) { $response->addStylesheet($file, '', array('media' => $media)); } foreach ($var->getJavascripts() as $file) { $response->addJavascript($file); } } } } return $viewName; }
/** * Executes the execute method of an action. * * @param sfAction $actionInstance An sfAction instance * * @return string The view type */ protected function executeAction($actionInstance) { // execute the action $viewName = parent::executeAction($actionInstance); // Add form js and stylesheets to response if ($viewName != sfView::NONE) { $response = $actionInstance->getResponse(); $actionVars = $actionInstance->getVarHolder()->getAll(); foreach ($actionVars as $var) { if ($var instanceof sfForm) { foreach ($var->getStylesheets() as $file => $media) { $response->addStylesheet($file, '', array('media' => $media)); } foreach ($var->getJavascripts() as $file) { $response->addJavascript($file); } } } } return $viewName; }