drupal 7 development: beginning module development

Post on 17-Jan-2017

151 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

BEGINNING MODULE DEVELOPMENT

Joe Crespo | Developer, Aten Design Group

YOUR NOT-SO-HUMBLE PRESENTERDesktop publishing >> Graphic design >> Web design >> PHP developer >> Drupal

Joe Crespo | Developer, Aten Design Group

“Hello World”

PART 1

DRUPAL TOOLBOX

Get to know these things: (if you don’t already)

1. Git: The version control software of choice for Drupal.

2. drush: A command line tool used for Drupal development.

3. devel: A really useful Drupal development module.

4. IRC: Internet Relay Chat (IM). #drupal-colorado

5. api.drupal.org is your new best friend.

Beginning Module Development | Intro

DRUPAL TOOLBOX

Super-common Drupal functions we’ll look at today:

1. arg() - http://bit.ly/function_arg

2. form_set_error() - http://bit.ly/form_set_error

3. check_plain() - http://bit.ly/check_plain

4. t() - http://bit.ly/function_t

Super-common functions we probably won’t get to:

1. variable_get() - http://bit.ly/variable_get

2. variable_set() - http://bit.ly/variable_set

Beginning Module Development | Intro

DRUPAL TOOLBOX

The ‘devel’ module… essential! Essential!! ESSENTIAL!!!

Provides the world’s most useful function:

• dpm() - http://bit.ly/function_dpm

Gives you a great place to test your scripts:

• http://yoursite.domain/devel/php

Beginning Module Development | Intro

Hooks are functions automatically called during execution.

Your module makes changes to content or functionality by invoking these hooks.

Beginning Module Development | Getting Started

For example: Your Module Name: my_first_moduleDrupal Hook:  hook_form_alter()Module invokes Hook with my_first_module_form_alter()

DRUPAL TOOLBOX: HOOKS

DRUPAL TOOLBOX: HOOKS

Hooks you'll use constantly!

1. hook_init() - http://bit.ly/hook_init (sparingly!)

2. hook_form_alter() - http://bit.ly/form_alter

Other super-common hooks we won’t get to today:

1. hook_menu() - http://bit.ly/hook_menu

2. hook_node_presave() - http://bit.ly/hook_node_presave

3. hook_form_FORM_ID_alter() - http://bit.ly/hook_form_FORM_ID_alter

4. hook_form_BASE_FORM_ID_alter()- http://bit.ly/hook_form_BASE_FORM_ID_alter

Beginning Module Development | Intro

PART 2Rules of Thumb

DRUPAL DEVELOPMENT PRINCIPLES

“Every time you hack core, God kills a kitten”

Beginning Module Development | Rules of Thumb

DRUPAL PRESENTATION

OBLIGATORY KITTEN PHOTO

Separate Drupal core modules, contrib modules, and your custom modules.

ORGANIZING YOUR SITE

Beginning Module Development | Rules of Thumb

• Always keep in mind that the

module you are contemplating might

already exist.

• Search Drupal.org to see if the

module has already been built.

• If you don’t find an obvious answer,

ask on IRC.

BEFORE YOU START DEVELOPING A MODULE

Beginning Module Development | Rules of Thumb

Clear the cache

Clear the Clear the cache

Clear the cacheClear the cache

Clear the cacheClear the cache

Clear the cacheClear the cache

Clear the cacheClear the cache

Clear the cache

Clear the cache

Clear the Clear the cache

Clear the cache

Clear the cache

Clear the cacheClear the cache

Clear the cacheClear the cache

Clear the cacheClear the cache

Clear the cacheClear the cache

Clear the cache

Clear the

Clear the cacheClear the cacheClear the cacheClear the cacheClear the cache

Clear the cacheClear the cache

Clear the cacheClear the cache

Clear the cache

Clear the cacheClear the

Clear the cache

Clear the cache

Clear the cache

Clear the cacheClear the cache

Clear the cacheClear the cacheClear the cacheClear the cache

Clear the cacheClear the cache

Beginning Module Development | Rules of Thumb

PART 3The long, long live demo(operating without a net)

CONCLUSION

BEGINNING MODULE DEVELOPMENT

Joe Crespo | Developer, Aten Design Group

top related