37
5 Important Tools for Drupal Development July 14, 2011

5 Important Tools for Drupal Development

  • Upload
    jcarrig

  • View
    14.898

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 5 Important Tools for Drupal Development

5 Important Tools for Drupal DevelopmentJuly 14, 2011

Page 2: 5 Important Tools for Drupal Development

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

Page 3: 5 Important Tools for Drupal Development

DRUPALCONTRIB.ORGTOOL #1

ANTHOLOGYMARKETING.COM

Page 4: 5 Important Tools for Drupal Development

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

Page 5: 5 Important Tools for Drupal Development

drupalcontrib.org

• Search contrib modules

ANTHOLOGYMARKETING.COM

Page 6: 5 Important Tools for Drupal Development

Contrib API reference

ANTHOLOGYMARKETING.COM

Page 7: 5 Important Tools for Drupal Development

Add modules to documentation

ANTHOLOGYMARKETING.COM

Page 8: 5 Important Tools for Drupal Development

ADMINISTRATION MENUTOOL #2

ANTHOLOGYMARKETING.COM

Page 9: 5 Important Tools for Drupal Development

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

Page 10: 5 Important Tools for Drupal Development

A comparison

Create a new CCK field for a custom content type

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

ANTHOLOGYMARKETING.COM

Page 11: 5 Important Tools for Drupal Development

Workflow example #1

1. Click on Administer

ANTHOLOGYMARKETING.COM

Page 12: 5 Important Tools for Drupal Development

Workflow example #1

2. Click Content Types

ANTHOLOGYMARKETING.COM

Page 13: 5 Important Tools for Drupal Development

Workflow example #1

3. Click manage fields

ANTHOLOGYMARKETING.COM

Page 14: 5 Important Tools for Drupal Development

Workflow example #1

4. Find desired field row and click on configure

ANTHOLOGYMARKETING.COM

Page 15: 5 Important Tools for Drupal Development

Workflow example #2

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

ANTHOLOGYMARKETING.COM

Page 16: 5 Important Tools for Drupal Development

DRUSHTOOL #3

ANTHOLOGYMARKETING.COM

Page 17: 5 Important Tools for Drupal Development

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

Page 18: 5 Important Tools for Drupal Development

Requirements

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

ANTHOLOGYMARKETING.COM

Page 19: 5 Important Tools for Drupal Development

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

Page 20: 5 Important Tools for Drupal Development

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…

Page 21: 5 Important Tools for Drupal Development

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

Page 22: 5 Important Tools for Drupal Development

DEVEL THEMERTOOL #4

ANTHOLOGYMARKETING.COM

Page 23: 5 Important Tools for Drupal Development

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

Page 24: 5 Important Tools for Drupal Development

Drupal Theme

ANTHOLOGYMARKETING.COM

http://drupal.org/node/173880

Page 25: 5 Important Tools for Drupal Development

Drupal Theme

ANTHOLOGYMARKETING.COM

http://drupal.org/node/173880

Page 26: 5 Important Tools for Drupal Development

Devel Themer in action

• Theme hierarchy• Template information• Link to template

source file• Possible names of

overriding template files

ANTHOLOGYMARKETING.COM

Page 27: 5 Important Tools for Drupal Development

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

Page 28: 5 Important Tools for Drupal Development

DRUPAL FOR FIREBUGTOOL #5

ANTHOLOGYMARKETING.COM

Page 29: 5 Important Tools for Drupal Development

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

Page 30: 5 Important Tools for Drupal Development

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

Page 31: 5 Important Tools for Drupal Development

Viewing objects

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

ANTHOLOGYMARKETING.COM

Page 32: 5 Important Tools for Drupal Development

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

Page 33: 5 Important Tools for Drupal Development

Now available for Chrome!

• Use your preferred developing browser!

ANTHOLOGYMARKETING.COM

Page 34: 5 Important Tools for Drupal Development

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

Page 35: 5 Important Tools for Drupal Development

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

Page 36: 5 Important Tools for Drupal Development

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

Page 37: 5 Important Tools for Drupal Development

Questions?

ANTHOLOGYMARKETING.COM