home
Hero image for: Synchronize Drupal Console with Drupal 8 beta 4

Synchronize Drupal Console with Drupal 8 beta 4

By Jesus Manuel Olivas ● Head of Products | December 17th, 2014

After a couple of sprints and few weeks doing client work, I am back on contribute mode, and I am using my time to make sure the Drupal Console is in sync with the latest Drupal 8 Beta 4 release.

Disclaimer: Before this update, the Drupal Console was in sync with Beta 2 and maybe some of the changes I will mention here are related to Beta 3.

In order to keep track of the required changes I add an issue on the github repository:

https://github.com/hechoendrupal/DrupalAppConsole/issues/238

The only command with issues was the controller generator

After running the generate:controller command and try loading the page I found the following issues:

Issue: 'Page not found' message when loading '/demo/hello/Drupal'

Fix: _content is no longer a valid keyword on the routing definition _controller must be used instead.

  # old generated code
  _content: '\Drupal\demo\Controller\DefaultController::hello'

  # new generated code
  _controller: '\Drupal\demo\Controller\DefaultController::hello'

If interested you can see the commit fixing this issue.

I also take a look at the documentation and update the An introductory example to Drupal 8 routes and controllers documentation page to reflect this change.

After changing route definition a new error show up.

Issue: 'Not Acceptable' error message and a blank page.

Fix: A Controller method not longer accept String as return value, must return either a renderable array or a Response Object.

  // old generated code
  return 'Hello '.$name.'!';

  // new generated code
  return [
    '#type' => 'markup',
    '#markup' => $this->t('Hello @name!', ['@name' => $name])
  ];

If interested you can see the commit fixing this issue.

Awesome just a few fixes and the Drupal Console is in sync with the latest Drupal 8 Beta 4 and we have a release v0.3.1 for the project.

Feel free to try this project, you can find installing instructions on my previous post Try the new Drupal Console installer and executable phar file and as usual feel free to ask any questions commenting on this page, or adding a new issue on the drupal project page or the github repository.