コード例 #1
0
 /**
  *
  */
 public function onKernelView(GetResponseForControllerResultEvent $event)
 {
     $request = $event->getRequest();
     $page_callback_result = $event->getControllerResult();
     if ((is_string($page_callback_result) || is_array($page_callback_result)) && $this->matcher->matches($request)) {
         $router_item = $request->attributes->get('_router_item', array());
         $default_delivery_callback = isset($router_item) && $router_item ? $router_item['delivery_callback'] : NULL;
         drupal_deliver_page($page_callback_result, $default_delivery_callback);
     }
 }
コード例 #2
0
ファイル: js.php プロジェクト: johnedelatorre/fusion
require_once DRUPAL_ROOT . '/includes/unicode.inc';
require_once DRUPAL_ROOT . '/includes/file.inc';
/**
 * @} End of "Required core files".
 */
// Do basic bootstrap to make sure the database can be accessed.
drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
// Prevent Devel from hi-jacking our output in any case.
$GLOBALS['devel_shutdown'] = FALSE;
$return = js_execute_callback();
// Menu status constants are integers; page content is a string.
if (is_int($return)) {
    // Make sure the full bootstrap has ran.
    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
    // Deliver error page.
    drupal_deliver_page($return);
} elseif (isset($return)) {
    // If JavaScript callback did not exit, print any value (including an empty
    // string) except NULL or undefined.
    drupal_json_output($return);
}
/**
 * Loads the requested module and executes the requested callback.
 *
 * @return
 *   The callback function's return value or one of the JS_* constants.
 */
function js_execute_callback()
{
    $args = explode('/', $_GET['q']);
    // If i18n is enabled and therefore the js module should boot
コード例 #3
0
ファイル: Drupal.php プロジェクト: Djecan/EkinoDrupalBundle
 /**
  * {@inheritdoc}
  */
 public function render()
 {
     if ($this->state < self::STATE_INNER_CONTENT) {
         throw new InvalidStateMethodCallException();
     }
     if ($this->state == self::STATE_RESPONSE) {
         return;
     }
     // Deliver the result of the page callback to the browser, or if requested,
     // return it raw, so calling code can do more processing.
     $content = $this->encapsulate(function (DrupalInterface $drupal) {
         $routerItem = $drupal->getRouterItem();
         $defaultDeliveryCallback = $routerItem ? $routerItem['delivery_callback'] : NULL;
         $pageResultCallback = $drupal->getPageResultCallback();
         drupal_deliver_page($pageResultCallback, $defaultDeliveryCallback);
         $drupal->setPageResultCallback($pageResultCallback);
     }, $this);
     $this->response->setContent($content);
     $this->state = self::STATE_RESPONSE;
 }