when webform and feeds aren't enough

22
WHEN WEBFORM AND FEEDS AREN’T ENOUGH ^AND NODES Monday, July 30, 2012

Upload: forum-one

Post on 07-May-2015

1.079 views

Category:

Business


0 download

TRANSCRIPT

Page 1: When Webform and Feeds Aren't Enough

WHEN WEBFORM AND FEEDS AREN’T ENOUGH^AND NODES

Monday, July 30, 2012

Page 2: When Webform and Feeds Aren't Enough

2

WELCOME!

Monday, July 30, 2012

Page 3: When Webform and Feeds Aren't Enough

ABOUT ME / USKeenan  Holloway  ::  DeveloperFORUM  ONE  ::  forumone.com

Monday, July 30, 2012

Page 4: When Webform and Feeds Aren't Enough

THIS SESSION WILL COVER:An  overview  of  the  Data  module-­‐  What  it  does,  Strengths,  Weaknesses

Various  valuable  uses-­‐  CreaHng/Defining  Data-­‐  ManipulaHng  Data  through  custom  Forms  module,  Direct  

database  insert,  and  Views-­‐  InteracHng  with  data  through  Views  and  Panels

Monday, July 30, 2012

Page 5: When Webform and Feeds Aren't Enough

WHAT IT DOESHelps  you  model,  manage  and  query  custom  tables.

Offers  an  administra@on  interface  and  a  low  level  API  for  manipula@ng  tables  and  accessing  their  contents.

Provides  Views  integra@on.

Monday, July 30, 2012

Page 6: When Webform and Feeds Aren't Enough

STRENGTHSGreat  for  flat  simple  data  sets.

Great  for  data  that  is  frequently  updated.

Great  for  custom  module  interac@on.

Simplis@c  table  design.

Built  on  en@ty  framework.

Integrates  with  views.

Monday, July 30, 2012

Page 7: When Webform and Feeds Aren't Enough

WEAKNESSESQuite  a  few  bugs  present  most  likely  as  a  result  of  updated  support  modules.

Coding  required  for  complex  table  rela@onships.

Search  and  Feeds  integra@on  are  a  liLle  buggy  and  require  numerous  patches.

Monday, July 30, 2012

Page 8: When Webform and Feeds Aren't Enough

8

DATA VS NODES

Monday, July 30, 2012

Page 9: When Webform and Feeds Aren't Enough

CAPITAL BIKESHARELETS BUILD IT!

9

capitalbikeshare.com

Monday, July 30, 2012

Page 10: When Webform and Feeds Aren't Enough

2012 Q1 TRIP HISTORY DATAid;  bikeid;  sta+onid;W00006    ;  31237;W00008    ;  31238;W00009    ;  31011;W00010    ;  31305;W00012    ;  31622;W00013    ;  31703;W00014    ;  31108;  ...  ;  ...

Monday, July 30, 2012

Page 11: When Webform and Feeds Aren't Enough

MODULE VERSIONSdata-­‐7.x-­‐1.x-­‐dev-­‐  Must  Install  Patch-­‐  h;p://drupal.org/node/1412014#comment-­‐5697626

ctools-­‐7.x-­‐1.x-­‐devviews-­‐7.x-­‐3.x-­‐devpanels-­‐7.x-­‐3.x-­‐dev

Monday, July 30, 2012

Page 12: When Webform and Feeds Aren't Enough

WE NEED BIKE STATIONS

Monday, July 30, 2012

Page 13: When Webform and Feeds Aren't Enough

WE NEED BIKES

Monday, July 30, 2012

Page 14: When Webform and Feeds Aren't Enough

LETS ADOPT THEM

Monday, July 30, 2012

Page 15: When Webform and Feeds Aren't Enough

DEMONSTRATION TIME!

15

Monday, July 30, 2012

Page 16: When Webform and Feeds Aren't Enough

sites/all/modules/contrib/bikes/bikes.info

name  =  Bikesdescrip/on  =  Form  UI  to  add  addi/onal  bikes.package  =  Bikescore  =  7.xphp  =  5.2

Monday, July 30, 2012

Page 17: When Webform and Feeds Aren't Enough

sites/all/modules/contrib/bikes/bikes.module

<?php

/**  *  Implements  hook_menu().  */func/on  bikes_menu()  {    //  Add  menu  item  callback  for  custom  form    $items['bikes/add']  =  array(        'type'  =>  MENU_CALLBACK,            'page  callback'  =>  'drupal_get_form',            'page  arguments'  =>  array('bikes_myform'),  //  Returns  our  custom  form  item            'access  arguments'  =>  array('access  content'),  //  Sets  access  to  see  this  form        );

   return  $items;}

Monday, July 30, 2012

Page 18: When Webform and Feeds Aren't Enough

sites/all/modules/contrib/bikes/bikes.module  (Con@nued...)

/*  *  Defines  the  custom  input  form  */func/on  bikes_myform()  {

   //  Define  form  input  field  for  Bike  ID    $form['id']  =  array(        '#type'  =>  'tex]ield',        '#/tle'  =>  t('Bike  ID'),        '#size'  =>  30,        '#maxlength'  =>  64,        '#descrip/on'  =>  t('Enter  the  ID  of  the  bike.'),    );

   //  Define  form  input  field  for  Sta/on  ID    $form['sta/on_id']  =  array(        '#type'  =>  'tex]ield',        '#/tle'  =>  t('Sta/on  ID'),        '#size'  =>  30,        '#maxlength'  =>  64,        '#descrip/on'  =>  t('Enter  the  sta/on  ID  of  the  bike.'),    );

   //  Define  form  submit  bucon    $form['submit']  =  array('#type'  =>  'submit',  '#value'  =>  t('Save'));

   return  $form;}

Monday, July 30, 2012

Page 19: When Webform and Feeds Aren't Enough

sites/all/modules/contrib/bikes/bikes.module  (Con@nued...)

/*  *  Defines  submit  opera/ons  */func/on  bikes_myform_submit($form,  &$form_state)  {

   //  On  submit,  insert  the  Bike  ID  and  Sta/on  ID  fields  into  the  'bikes'  table    db_insert('bikes')    -­‐>fields(array(        'bikeid'  =>  $form_state['values']['id'],        'sta/onid'  =>  $form_state['values']['sta/on_id'],    ))    -­‐>execute();

   //  Set  the  confirma/on  message    drupal_set_message(t('Your  form  has  been  saved.'));}

Monday, July 30, 2012

Page 20: When Webform and Feeds Aren't Enough

WHAT WE COVERED:An  overview  of  the  Data  module-­‐  What  it  does,  Strengths,  Weaknesses

Various  valuable  uses-­‐  CreaHng/Defining  Data-­‐  ManipulaHng  Data  through  custom  Forms  module,  Direct  

database  insert,  and  Views-­‐  InteracHng  with  data  through  Views  and  Panels

Monday, July 30, 2012

Page 21: When Webform and Feeds Aren't Enough

THANKS!QUESTIONS AND ANSWERS

21

Monday, July 30, 2012