5 Important Tools for Drupal Development

Post on 12-May-2015

14.898 views 0 download

Tags:

Transcript of 5 Important Tools for Drupal Development

5 Important Tools for Drupal DevelopmentJuly 14, 2011

5 Important Tools for Drupal Development

Overview• A talk of 5 tools to aid you in

developing, administering, and maintaining Drupal sites.

Goals• Spark an “ah hah!” moment• Introduce new ideas and techniques• Get you excited about Drupal

ANTHOLOGYMARKETING.COM

DRUPALCONTRIB.ORGTOOL #1

ANTHOLOGYMARKETING.COM

Contrib is

• how Drupal is extended and customized.

• made up of 8292 modules today.

• written by the community and shared under the same GNU Public License (GPL) as Drupal.

• not shipped with Drupal core releases.

• shaping future releases of Drupal.

ANTHOLOGYMARKETING.COM

drupalcontrib.org

• Search contrib modules

ANTHOLOGYMARKETING.COM

Contrib API reference

ANTHOLOGYMARKETING.COM

Add modules to documentation

ANTHOLOGYMARKETING.COM

ADMINISTRATION MENUTOOL #2

ANTHOLOGYMARKETING.COM

A simple administrative interface

• The menu is theme independent• CSS-based drop down style menu• Eliminates unnecessary page loads and clicks• For D6, D7

ANTHOLOGYMARKETING.COM

A comparison

Create a new CCK field for a custom content type

• Workflow #1 – without administration menu• Workflow #2 – with administration menu

ANTHOLOGYMARKETING.COM

Workflow example #1

1. Click on Administer

ANTHOLOGYMARKETING.COM

Workflow example #1

2. Click Content Types

ANTHOLOGYMARKETING.COM

Workflow example #1

3. Click manage fields

ANTHOLOGYMARKETING.COM

Workflow example #1

4. Find desired field row and click on configure

ANTHOLOGYMARKETING.COM

Workflow example #2

1. Navigate the admin menu until you find the desired field and click on configure

ANTHOLOGYMARKETING.COM

DRUSHTOOL #3

ANTHOLOGYMARKETING.COM

What is drush?

• Drupal + shell = Drush

• Drush is a command line shell and scripting interface for installing, developing, and maintaining Drupal sites.

• Intended Users– Developers– Admins

ANTHOLOGYMARKETING.COM

Requirements

Server• CLI-mode capable PHP binary, PHP 5.2 or greater• Drupal 5.x-2.5 or later• SSH access

ANTHOLOGYMARKETING.COM

Installation

Download (and extract):

~ $ wget http://ftp.drupal.org/files/projects/drush-7.x-4.4.tar.gz

ANTHOLOGYMARKETING.COM

Make sure drush is executable:

~ $ chmod u+x /path/to/drush/drush

Add Alias to ~/.bashrc:

~ $ alias drush=‘/path/to/drush/drush’

Reload bash and type drush:

~ $ drush

Using Drush

Navigate to Drupal site folder:

~ $ cd /path/to/drupal/web

ANTHOLOGYMARKETING.COM

Check site status:

~ $ drush status Drupal version : 6.22 Site URI : http://default Database driver : mysqli Database hostname : localhost Database username : drupaluser Database : Connected Drupal bootstrap : Successful etc…

Example use cases

Download (and extract) views module:

~ $ drush dl views

ANTHOLOGYMARKETING.COM

Clear site cache:

~ $ drush cc

Run cron:

~ $ drush cron

Update core, enabled modules, and database:

~ $ drush up

DEVEL THEMERTOOL #4

ANTHOLOGYMARKETING.COM

Devel Themer

• Theming tool• Depends on Devel• No current stable

release due to erratic behaviors in less stable browsers

• Turn on/off with drush• For D6, D7

ANTHOLOGYMARKETING.COM

Drupal Theme

ANTHOLOGYMARKETING.COM

http://drupal.org/node/173880

Drupal Theme

ANTHOLOGYMARKETING.COM

http://drupal.org/node/173880

Devel Themer in action

• Theme hierarchy• Template information• Link to template

source file• Possible names of

overriding template files

ANTHOLOGYMARKETING.COM

Remember

ANTHOLOGYMARKETING.COM

• Enable/Disable devel_themer with drush• After enabling, refresh your browser to load the themer• Check box turns themer on• Hover over elements on the page• Use suggested overrides and naming conventions• Clear cache and test theme

DRUPAL FOR FIREBUGTOOL #5

ANTHOLOGYMARKETING.COM

Drupal for Firebug

• Extends the Firefox browser plugin, Firebug– http://getfirebug.com/

• Enhancing Drupal debugging through the browser console.

• Provides insight into node, form, user objects• Works with Devel module to display SQL queries and

execute PHP from the browser• Also works with Views if installed

ANTHOLOGYMARKETING.COM

Installing Drupal for Firebug

• Install Firebug– http://getfirebug.com/

• Install Drupal for Firebug Add-on:– https://addons.mozilla.org/en-US/firefox/

addon/drupal-for-firebug/

• Install Drupal for Firebug module:– http://drupal.org/project/drupalforfirebug

ANTHOLOGYMARKETING.COM

Viewing objects

• Visualize the processing of objects– First the node is loaded– Then ready to be viewed– Then altered by modules

ANTHOLOGYMARKETING.COM

Helping developers

• Developers can write to firebug log!

• Example use in custom module:

ANTHOLOGYMARKETING.COM

function firep($element, $title = NULL)

http://jbenner.net/blog/drupal-for-firebug

Now available for Chrome!

• Use your preferred developing browser!

ANTHOLOGYMARKETING.COM

Resources

Drupal API Reference• Drupal core: http://api.drupal.org• Drupal contrib: http://drupalcontrib.org

Administration Menu• Project page: http://drupal.org/project/admin_menu• Demo: http://www.youtube.com/watch?v=3YgnIFi73QI

ANTHOLOGYMARKETING.COM

Resources

Drush• Project page: http://drupal.org/project/drush• Home page: http://drush.ws• Installation: http://openspring.net/tip/how-to-install-drush-

serverwide-in-less-than-one-minute

Devel Themer• Project page: http://drupal.org/project/devel_themer• Themable output: http://drupal.org/node/173880• Template preproccess: http://drupal.org/node/223430

ANTHOLOGYMARKETING.COM

Resources

Drupal for Firebug• Firebug: http://getfirebug.com/• Firefox Add-on:

https://addons.mozilla.org/en-US/firefox/addon/drupal-for-firebug/

• Chrome Add-on: https://chrome.google.com/webstore/detail/imlijcpfmhmifofiihbofoamohkdbblc

• Project page: http://drupal.org/project/drupalforfirebug• Review: http://jbenner.net/blog/drupal-for-firebug

ANTHOLOGYMARKETING.COM

Questions?

ANTHOLOGYMARKETING.COM