Future-Proof Your Drupal 7 Site

Midcamp 2014

Dave Reid / @davereid

https://slid.es/davereid/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


Navbar



Inline Editing



Official WYSIWYG: CKEditor


Responsive Preview


Not officially in D8: https://drupal.org/node/1741498

Responsive Bartik

https://drupal.org/project/responsive_bartik


HTML5


VIEWS IN CORE!


Administration Views

https://drupal.org/project/admin_views


Views Bulk Operations (light)

https://drupal.org/project/views_bulk_operations


Views Responsive Grid


Responsive Tables


Breakpoints


Responsive Pictures


Tours


Module page filtering

https://drupal.org/project/instantfilter



Simplified Menu Administration

https://drupal.org/project/simplified_menu_admin


Escape Admin



Field types

Entity reference

NOT Node or User reference modules

Telephone

NOT phone module

Email (lite)

URL

NOT link module

Datetime (Date lite)


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/MyModuleHookDefaultPlugin.php
abstract class MyModuleHookDefaultPlugin 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 MyModuleHookDefaultPlugin {
  public function process($config) {
    // Do stuff!
  }
}

The Other Stuff

CMI


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


PSR-0 / PSR-4

https://drupal.org/project/xautoload

More things

Composer / Composer Manager
phpunit
D7 libraries (Symfony, backbone, etc)
Bean for blocks
JS local storage
Caption filter
Guzzle

Things you should probably stop using

We don't want no scrubs


Thank you!
Questions?

2014-03-29

By davereid

2014-03-29

  • 3,309