Drupal needs to evolve, and quickly, from a first-class web CMS into a first-class REST server that includes a first-class web CMS.
Drupal needs to evolve, and quickly, from a first-class web CMS into a first-class REST server that includes a first-class web CMS.
Hey, look, a first-class REST server!
/** * @file * The PHP page that serves all requests on a Drupal installation. */ /** * Root directory of Drupal installation. */ define('DRUPAL_ROOT', getcwd()); require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); menu_execute_active_handler();
use Drupal\Core\DrupalKernel; use Symfony\Component\HttpFoundation\Request; define('DRUPAL_ROOT', getcwd()); // Bootstrap all of Drupal's legacy subsystems. // @see Drupal\Core\EventSubscriber\PathSubscriber; // @see Drupal\Core\EventSubscriber\LegacyRequestSubscriber; require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE); // @todo Figure out how best to handle the Kernel constructor parameters. $kernel = new DrupalKernel('prod', FALSE); $request = Request::createFromGlobals(); $response = $kernel->handle($request)->prepare($request)->send(); $kernel->terminate($request, $response);
function drupal_container(ContainerBuilder $reset = NULL) { static $container = NULL; if (isset($reset)) { $container = $reset; } elseif (!isset($container)) { $container = new ContainerBuilder(); } return $container; }
$langcode = drupal_container()->get('language_interface')->langcode;
Now we can inject the language as we move other things into the container.
Eventually remove the wrapper function and inject all the things!
Benefits
Limitations
function mymodule_node_access($node, $op, $account) { if ($op == 'edit' && $node->uid == $account->uid && $node->created > (REQUEST_TIME - 3600)) { return NODE_ACCESS_ALLOW; } return NODE_ACCESS_IGNORE; }
$return = module_invoke_all('node_access', $node, 'update', $account);
Prediction (warning, I know better than to gamble):
Benefits
Drawbacks
We must get rid of these
Arrays of Doom.
Maybe!
Benefits
Drawbacks
We could use a hand!
Considering...
Coordination
drupal_set_message()