Future-Proof Your Drupal 7 Site

Midcamp 2014

Dave Reid / @davereid

davereid.github.io/2014-03-29

About Me


Senior Developer at Lullabot

Twitter: @davereid

IRC: davereid

Maintain amost 2% of contrib modules

Core subsystem maintainer

Father of two cats and one boy



Objectives


For your site builders
and architects to make
informed choices now


Ease pain of site users
when switching to Drupal 8

User Interface

Spark Distribution

https://drupal.org/project/spark


Navbar

https://drupal.org/project/navbar


Inline Editing

https://drupal.org/project/edit


Official WYSIWYG: CKEditor

https://drupal.org/project/ckeditor

Responsive Bartik

https://drupal.org/project/responsive_bartik


HTML5

https://drupal.org/project/elements
https://drupal.org/project/html5_tools

VIEWS IN CORE!

https://drupal.org/project/views

Administration Views

https://drupal.org/project/admin_views


Views Bulk Operations (light)

https://drupal.org/project/views_bulk_operations


Views Responsive Grid

https://drupal.org/project/views_responsive_grid

Responsive Tables

https://drupal.org/project/responsive_tables

Breakpoints

https://drupal.org/project/breakpoints

Responsive Pictures

https://drupal.org/project/picture

Tours

https://drupal.org/project/joyride

Module page filtering

https://drupal.org/project/instantfilter



Simplified Menu Administration

https://drupal.org/project/simplified_menu_admin


Escape Admin

https://drupal.org/project/escape_admin


Caption Filter

https://drupal.org/project/caption_filter

<img data-align="center" data-caption="Test caption" ... />

Custom blocks (Bean)

https://drupal.org/project/bean


Field types

Entity reference

https://drupal.org/project/entityreference
NOT Node or User reference modules

Telephone

https://drupal.org/project/telephone
NOT phone module

Email (lite)

https://drupal.org/project/email

URL

https://drupal.org/project/url
NOT link module

Datetime (Date lite)

https://drupal.org/project/date

For developers


APIs and Plugins
Libraries

Hooks


/**
 * Implements hook_mymodule_hook_info().
 */
function example_mymodule_hook_info() {
  $info['example'] = array(
    'label' => t('Example implementation'),
    'callback' => 'example_mymodule_callback',
    'settings form' => 'example_mymodule_form',
  );
  return $info;
}

CTools plugins

/**
 * Implements hook_ctools_plugin_directory().
 */
function example_ctools_plugin_directory($module, $plugin) {
  if ($module == 'mymodule' && $plugin == 'hook') {
    return "plugins/$module/$plugin";
  }
}

// plugins/example/hook/example_implementation.inc
$plugin = array(
  'title' => t('Example implementation'),
  'class' => 'ExampleMyModuleHookImplementation',
);

// plugins/example/hook/ExampleImplementation.class.php
class ExampleMyModuleHookImplementation {
  // Does stuff.
}

Plugins in D7

lib/MyModuleHookPluginInterface.php
class MyModuleHookPluginInterface {
  public static function getInstance($config = array());
  public function getDefaults();
  public function process($config);
}
lib/MyModuleHookPluginBase.php
abstract class MyModuleHookPluginBase extends MyModuleHookPluginInterface {
  public funciton getInstnace($config = array()) {
    $class = get_called_class();
    return new $class($config);
  }

  public function getDefaults() {
    return array();
  }

  abstract public function process($config);
}

Plugins in D7

example.module
/**
 * Implements hook_mymodule_hook_info().
 */
function example_mymodule_hook_info() {
  $info['example'] =
    'label' => t('Example implementation'),
    'class' => ExampleMyModuleHookPlugin',
  );
  return $info;
}
example.info

files[] = lib/ExampleMyModuleHookPlugin.php
lib/ExampleMyModuleHookPlugin.php
class ExampleMyModuleHookPlugin extends MyModuleHookPluginBase {
  public function process($config) {
    // Do stuff!
  }
}

The Other Stuff

Configurable view/display modes

https://drupal.org/project/entity_view_mode

CMI

https://drupal.org/project/configuration???

Migrate is your friend

https://drupal.org/project/migrate

https://drupal.org/project/migrate_d2d


RESTful Web Services

https://drupal.org/project/restws
NOT services module

Translation

https://drupal.org/project/entity_translation
https://drupal.org/project/title

PSR-0 / PSR-4

https://drupal.org/project/xautoload

More things

Composer / Composer Manager
phpunit
Symfony
Backbone
Underscore
Guzzle
JS local storage

Things you should probably stop using

We don't want no scrubs

https://drupal.org/node/2116417

Thank you!
Questions?