Drupal 7 module development

Post on 01-Nov-2014

1.763 views 3 download

Tags:

description

 

Transcript of Drupal 7 module development

Adam Kalseyadam@tropo.com@akalsey

www.Tropo.com@tropo

Who Am I?

Activity Stream

Phone Poll

Vote in polls with SMS or voice

http://www.flickr.com/photos/sanberdoo/510894918/

http://www.flickr.com/photos/comedynose/4584215861/

Luxe

Login User eXperience Enahcements

Passkey

Login integration with external systems

The Basics

http://www.flickr.com/photos/lrosa/2182577107

tropo.info

name  =  Tropodescription  =  Voice  and  SMS  Awesomenesscore  =  7.x

dependencies[]  =  views  (>2.1)

Mostly the same

/** * Remove block_callback field from {menu_router}. */function system_update_7064() { db_drop_field('menu_router', 'block_callback');}

Documentation that appears in update.php

Update comments

Everything’s an Object

Everything’s an Object

Nodes

Everything’s an Object

Nodes

Users

Everything’s an Object

Nodes

Users

Comments

Everything’s an Object

Nodes

Users

Comments

Files

Everything’s an Object

Nodes

Users

Comments

Files

Taxonomy Terms

Everything has a hook

http://www.flickr.com/photos/versageek

hook_nodeapi($op)

hook_node_load

hook_node_load

hook_user_load

hook_file_load

hook_comment_load

hook_taxonomy_term_load

hook_blah_load

hook_user($op)

hook_user($op)

hook_user_presavehook_user_inserthook_user_loadhook_user_operation

No moreUniversal Business Adaptors

Fields

http://www.flickr.com/photos/mikecattell

<?php  $node->body = array(    'und' => array(      array(        'value'  => 'body here',        'summary' => 'teaser here',        'format' => '1',        'safe_value' => 'sanitized body',        'safe_summary' => 'sanitized teaser',      )    ),  );?>

<?php// Drupal 6db_query("INSERT INTO {mytable} (intvar, stringvar, floatvar) VALUES (%d, '%s', %f)", 5, 'hello world', 3.14);$id = db_last_insert_id();

// Drupal 7$id = db_insert('mytable')  ->fields(array(    'intvar' => 5,    'stringvar' => 'hello world',    'floatvar' => 3.14,  ))  ->execute();?>

Form API

http://www.flickr.com/photos/teegardin

<?php  //Drupal 6  $form[$theme->name]['screenshot'] = array('#value' => $screenshot);

  //Drupal 7  $form[$theme->name]['screenshot'] = array('#markup' => $screenshot);?>

my_function($argument, array $options);

Function signatures

Lots of little function name changes

Set static variables with drupal_static()

Email assumes everything’s html

Block deltas can be arbitrary strings

New API for search tab creation

Lots of little function name changes

Set static variables with drupal_static()

Email assumes everything’s html

Block deltas can be arbitrary strings

New API for search tab creation

http://drupal.org/node/224333

Text

Coder Upgrade module

Automate the grunt work

Adam Kalseyadam@tropo.com@akalsey

www.Tropo.com@tropo