Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Drupal 8 Module Porting Workshop

Drupal 8 Module Porting Workshop

A presentation delivered to DrupalACT discussing why and how to port modules. An example module (Login Redirect) was shown and the port of that module discussed.

typhonius

May 21, 2014
Tweet

More Decks by typhonius

Other Decks in Technology

Transcript

  1. Benefits / why • https://drupal.org/node/2136029 • Uptake of 8.x will

    be stalled without contrib • Starting now will put you ahead of the curve
  2. What happened with 7.x? 7.x core 7.x views A: Release

    of Drupal 7.0 B: Release of Views 7.3-rc1
  3. Who else is becoming 8.x ready? • Views (in core)

    • devel(+kint) • Webform • Rules • Many more • Adam & Josh
  4. How to start porting • Start small - find a

    simple module ◦ select modules you’ve used ◦ < 15000 characters • Create your own • Follow examples ◦ pants.module ◦ example.module ◦ and any core modules
  5. Where to start architecturally • .info files are now yaml

    • menu routing is now yaml • variable system is gone (config is now yaml) • admin forms work differently (class per form) • The rest of the .module may be fairly similar
  6. CMI • Replacement for variable_* • Exportable ◦ defaults =>

    yaml ◦ active => db ◦ staging => files can be imported into active user.flood.yml user.mail.yml user.role.anonymous.yml user.role.authenticated.yml user.settings.yml $conf = \Drupal::config('user.flood'); uid_only: false ip_limit: 50 ip_window: 3600 user_limit: 5 user_window: 21600 $conf->get(‘user_limit’); 5 $conf->set(‘user_limit’, 1); $conf->save();
  7. How to alter menu paths in 8.x • hook_menu_link_defaults_alter •

    hook_menu_local_tasks_alter • hook_menu_local_actions_alter
  8. Chasing HEAD • For contrib work, use the latest release

    (alpha/beta/rc) • Assume HEAD will break your code • IDEs can help you with deprecations • Change notices are usually great to peruse