SlideShare uma empresa Scribd logo
1 de 41
Baixar para ler offline
Drupal is Stupid
                               (But I Love It Anyway)




Thursday, November 10, 11
oh hai

                    • Brock Boland, Jackson River
                    • @brock
                    • brock@brockboland.com
                    • GoSpringboard.com

Thursday, November 10, 11
Plan

                    • Drupal Overview
                    • What sucks
                    • What’s awesome


Thursday, November 10, 11
Drupal

                    • Open Source CMS
                    • 6 vs. 7
                    • Hook system
                    • Theme functions
                    • Contrib modules

Thursday, November 10, 11
Stupid



Thursday, November 10, 11
Core doesn’t do much



Thursday, November 10, 11
Animal Fun Fact #1




Thursday, November 10, 11
Animal Fun Fact #1




                            Source: http://blogs.dixcdn.com/shine_a_light/2011/02/02/love-birds/
Thursday, November 10, 11
Catch-all Hooks
                    • hook_block()
                            •   list, configure, save, view


                    • hook_taxonomy()
                            •   delete, insert, update


                    • hook_comment()
                            •   insert, update, view, validate, publish, unpublish, delete


                    • hook_nodeapi()
                            •   alter, delete, delete revision, insert, load, prepare, print, rss item, search
                                result, presave, update, update index, validate, view


Thursday, November 10, 11
No Objects



Thursday, November 10, 11
DB Layer

                    • Uses straight SQL queries
                    • db_query() and db_query_range()
                    • db_fetch_object() or db_fetch_array()
                    • drupal_write_record()

Thursday, November 10, 11
D6
     db_query("UPDATE {node_type} SET type = '%s', name = '%s', module = '%s', has_title = %d, title_label = '%s',
     has_body = %d, body_label = '%s', description = '%s', help = '%s', min_word_count = %d, custom = %d, modified =
     %d, locked = %d WHERE type = '%s'", $info->type, $info->name, $info->module, $info->has_title, $info-
     >title_label, $info->has_body, $info->body_label, $info->description, $info->help, $info->min_word_count, $info-
     >custom, $info->modified, $info->locked, $existing_type);


      D7
           $fields = array(                                      else {
              'type' => (string) $type->type,                      $fields['orig_type'] = (string) $type-
              'name' => (string) $type->name,                  >orig_type;
              'base' => (string) $type->base,                      db_insert('node_type')
              'has_title' => (int) $type->has_title,                 ->fields($fields)
              'title_label' => (string) $type->title_label,          ->execute();
              'description' => (string) $type->description,
              'help' => (string) $type->help,                      field_attach_create_bundle('node', $type-
              'custom' => (int) $type->custom,                 >type);
              'modified' => (int) $type->modified,
              'locked' => (int) $type->locked,                       module_invoke_all('node_type_insert', $type);
              'disabled' => (int) $type->disabled,                   $status = SAVED_NEW;
              'module' => $type->module,                         }
           );

           if ($is_existing) {
             db_update('node_type')
               ->fields($fields)
               ->condition('type', $existing_type)
               ->execute();

            if (!empty($type->old_type) && $type-
        >old_type != $type->type) {
              field_attach_rename_bundle('node', $type-
        >old_type, $type->type);
            }
            module_invoke_all('node_type_update', $type);
            $status = SAVED_UPDATED;
          }
Thursday, November 10, 11
Animal Fun Fact #2




Source: http://schoolworkhelper.net/2011/06/wolves-habitat-characteristics-behaviors/
Thursday, November 10, 11
Animal Fun Fact #2




Source: http://www.indyposted.com/135755/sarah-palin-hunting-clip-offends-some-over-animal-abuse-others-over-poor-hunting-skills-video/sarah-palin-hunting-2/
Thursday, November 10, 11
Multiple
                            Implementation
                               Options


Thursday, November 10, 11
Thursday, November 10, 11
Ajax/AHAH



Thursday, November 10, 11
DIY

 function ahah_callback_method() {
   // AHAH processing prep
   $form_state = array('storage' => NULL, 'submitted' => FALSE);
   $form_build_id = $_POST['form_build_id'];
   $form = form_get_cache($form_build_id, $form_state);

      $args = $form['#parameters'];
      $form_id = array_shift($args);
      $form_state['post'] = $form['#post'] = $_POST;
      $form['#programmed'] = $form['#redirect'] = FALSE;

   drupal_process_form($form_id, $form, $form_state);
   $form = drupal_rebuild_form($form_id, $form_state, $args,
 $form_build_id);

      // Now you can do stuff
 }

Thursday, November 10, 11
ahah_helper module
/**
                                                                                       // $form_state['submit_handlers'] and $form_state['validate_handlers'].
 * Given a POST of a Drupal form (with both a form_build_id set), this
                                                                                       // This problem does not exist when AHAH is disabled, because then the
 * function rebuilds the form and then only renders the given form item. If no
                                                                                       // assumption is true, and then you generally provide a button as an
 * form item is given, the entire form is rendered.
                                                                                       // alternative to the AHAH behavior.
 *
                                                                                       $form_state['submitted'] = TRUE;
 * Is used directly in a menu callback in ahah_helper's sole menu item. Can
                                                                                       // Continued from the above: when an AHAH update of the form is triggered
 * also be used in more advanced menu callbacks, for example to render
                                                                                       // without using a button, you generally don't want any validation to kick
 * multiple form items of the same form and return them separately.
                                                                                       // in. A typical example is adding new fields, possibly even required ones.
 *
                                                                                       // You don't want errors to be thrown at the user until they actually submit
 * @param $parents
                                                                                       // their values. (Well, actually you want to be smart about this: sometimes
 */
                                                                                       // you do want instant validation, but that's an even bigger pain to solve
function ahah_helper_render($form_item_to_render = FALSE) {
                                                                                       // here so I'll leave that for later…)
   $form_state = array('storage' => NULL, 'submitted' => FALSE);
                                                                                       if (!isset($_POST['op'])) {
   $form_build_id = $_POST['form_build_id'];
                                                                                         // For the default "{$form_id}_validate" and "{$form_id}_submit" handlers.
                                                                                         $form['#validate'] = NULL;
 // Get the form from the cache.
                                                                                         $form['#submit'] = NULL;
 $form = form_get_cache($form_build_id, $form_state);
                                                                                         // For customly set #validate and #submit handlers.
 $args = $form['#parameters'];
                                                                                         $form_state['submit_handlers'] = NULL;
 $form_id = array_shift($args);
                                                                                         $form_state['validate_handlers'] = NULL;
                                                                                         // Disable #required and #element_validate validation.
 // Are we on the node form?
                                                                                         _ahah_helper_disable_validation($form);
 $node_form = FALSE;
                                                                                       }
 if (preg_match('/_node_form$/', $form_id)) {
   $node_form = TRUE;
                                                                                       // Build, validate and if possible, submit the form.
   module_load_include('inc', 'node', 'node.pages');
                                                                                       drupal_process_form($form_id, $form, $form_state);
 }
                                                                                       if ($node_form) {
                                                                                         // get the node from the submitted values
 // We will run some of the submit handlers so we need to disable redirecting.
                                                                                         $node = node_form_submit_build_node($form, $form_state);
 $form['#redirect'] = FALSE;
 // We need to process the form, prepare for that by setting a few internals
                                                                                           // hack to stop taxonomy from resetting when the form is rebuilt
 // variables.
                                                                                           $form_state['node']['taxonomy'] = taxonomy_preview_terms($node);
 $form['#post'] = $_POST;
                                                                                       }
 $form['#programmed'] = FALSE;
 $form_state['post'] = $_POST;
                                                                                       // This call recreates the form relying solely on the form_state that the
                                                                                       // drupal_process_form set up.
 //    $form_state['storage']['#ahah_helper']['file'] has been set, to know
                                                                                       //$form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
 //    which file should be loaded. This is necessary because we'll use the form
                                                                                       $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
 //    definition itself rather than the cached $form.
 if    (isset($form_state['storage']['#ahah_helper']['file'])) {
                                                                                       // Get the form item we want to render.
      require_once($form_state['storage']['#ahah_helper']['file']);
                                                                                       $form_item = _ahah_helper_get_form_item($form, $form_item_to_render);
  }

                                                                                     // Get the JS settings so we can merge them.
 //    If the form is being rebuilt due to something else than a pressed button,
                                                                                     $javascript = drupal_add_js(NULL, NULL, 'header');
 //    e.g. a select that was changed, then $_POST['op'] will be empty. As a
                                                                                     $settings = call_user_func_array('array_merge_recursive',
 //    result, Forms API won't be able to detect any pressed buttons. Eventually
                                                                                   $javascript['setting']);
 //    it will call _form_builder_ie_cleanup(), which will automatically, yet
 //    inappropriately assign the first in the form as the clicked button. The
                                                                                       drupal_json(array(
 //    reasoning is that since the form has been submitted, a button surely must
                                                                                         'status'   => TRUE,
 //    have been clicked. This is of course an invalid reasoning in the context
                                                                                         'data'     => theme('status_messages') . drupal_render($form_item),
 //    of AHAH forms.
                                                                                         'settings' => array('ahah' => $settings['ahah']),
 //    To work around this, we *always* set $form_state['submitted'] to true,
                                                                                       ));
 //    this will prevent _form_builder_ie_cleanup() from assigning a wrong
                                                                                   }
 //    button. When a button is pressed (thus $_POST['op'] is set), then this
 //    button will still set $form_state['submitted'],

Thursday, November 10, 11
Assumes You Want an
                          HTML Page


Thursday, November 10, 11
Animal Fun Fact #3




                            Source: http://www.dailymail.co.uk/travel/article-1320804/Mountain-goats-climb-160ft-near-vertical-Cingino-dam.html

Thursday, November 10, 11
Animal Fun Fact #3




                            Source: http://www.dailymail.co.uk/travel/article-1320804/Mountain-goats-climb-160ft-near-vertical-Cingino-dam.html

Thursday, November 10, 11
Steep Learning Curve



Thursday, November 10, 11
Original source unknown

Thursday, November 10, 11
Wonky-ass Interface



Thursday, November 10, 11
Thursday, November 10, 11
Thursday, November 10, 11
Thursday, November 10, 11
Thursday, November 10, 11
Always Need
                            Custom Module(s)


Thursday, November 10, 11
Media Handling



Thursday, November 10, 11
Thursday, November 10, 11
Misc. Crap

                    • HTML5
                    • Mobile
                    • Configuration Management
                    • Content Migration

Thursday, November 10, 11
Still?
                            Pretty Awesome


Thursday, November 10, 11
Stable



Thursday, November 10, 11
Secure



Thursday, November 10, 11
Contrib Modules



Thursday, November 10, 11
Community



Thursday, November 10, 11
On the Whole?

                    • Stupid
                    • Getting better
                    • Still not going to use anything else


Thursday, November 10, 11
Questions?
                                    Which is funnier:

                            Pirate Monkey, or Aviator Monkey?




                                jacksonriver.com/monkeys


Thursday, November 10, 11
Once more

                    • Brock Boland
                    • @brock
                    • brock@brockboland.com


Thursday, November 10, 11

Mais conteúdo relacionado

Mais procurados

Drupal Development (Part 2)
Drupal Development (Part 2)Drupal Development (Part 2)
Drupal Development (Part 2)Jeff Eaton
 
Fields in Core: How to create a custom field
Fields in Core: How to create a custom fieldFields in Core: How to create a custom field
Fields in Core: How to create a custom fieldIvan Zugec
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium AppsNate Abele
 
Ajax nested form and ajax upload in rails
Ajax nested form and ajax upload in railsAjax nested form and ajax upload in rails
Ajax nested form and ajax upload in railsTse-Ching Ho
 
WordPress plugin #3
WordPress plugin #3WordPress plugin #3
WordPress plugin #3giwoolee
 
Drupal - dbtng 25th Anniversary Edition
Drupal - dbtng 25th Anniversary EditionDrupal - dbtng 25th Anniversary Edition
Drupal - dbtng 25th Anniversary Editionddiers
 
Coding for Scale and Sanity
Coding for Scale and SanityCoding for Scale and Sanity
Coding for Scale and SanityJimKellerES
 
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonfRafael Dohms
 
Drupal Step-by-Step: How We Built Our Training Site, Part 1
Drupal Step-by-Step: How We Built Our Training Site, Part 1Drupal Step-by-Step: How We Built Our Training Site, Part 1
Drupal Step-by-Step: How We Built Our Training Site, Part 1Acquia
 
Drupal 8: Routing & More
Drupal 8: Routing & MoreDrupal 8: Routing & More
Drupal 8: Routing & Moredrubb
 
Building Large jQuery Applications
Building Large jQuery ApplicationsBuilding Large jQuery Applications
Building Large jQuery ApplicationsRebecca Murphey
 
First Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentFirst Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentNuvole
 
JavaScript in Drupal 7: What developers need to know
JavaScript in Drupal 7: What developers need to knowJavaScript in Drupal 7: What developers need to know
JavaScript in Drupal 7: What developers need to knowkatbailey
 
Drupal 8 Sample Module
Drupal 8 Sample ModuleDrupal 8 Sample Module
Drupal 8 Sample Moduledrubb
 
Functionality Focused Code Organization
Functionality Focused Code OrganizationFunctionality Focused Code Organization
Functionality Focused Code OrganizationRebecca Murphey
 
Routing in Drupal 8
Routing in Drupal 8Routing in Drupal 8
Routing in Drupal 8kgoel1
 
Dependency injection - phpday 2010
Dependency injection - phpday 2010Dependency injection - phpday 2010
Dependency injection - phpday 2010Fabien Potencier
 
Goodbye hook_menu() - Routing and Menus in Drupal 8
Goodbye hook_menu() - Routing and Menus in Drupal 8Goodbye hook_menu() - Routing and Menus in Drupal 8
Goodbye hook_menu() - Routing and Menus in Drupal 8Exove
 

Mais procurados (20)

Drupal Development (Part 2)
Drupal Development (Part 2)Drupal Development (Part 2)
Drupal Development (Part 2)
 
Fields in Core: How to create a custom field
Fields in Core: How to create a custom fieldFields in Core: How to create a custom field
Fields in Core: How to create a custom field
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium Apps
 
Ajax nested form and ajax upload in rails
Ajax nested form and ajax upload in railsAjax nested form and ajax upload in rails
Ajax nested form and ajax upload in rails
 
WordPress plugin #3
WordPress plugin #3WordPress plugin #3
WordPress plugin #3
 
Drupal - dbtng 25th Anniversary Edition
Drupal - dbtng 25th Anniversary EditionDrupal - dbtng 25th Anniversary Edition
Drupal - dbtng 25th Anniversary Edition
 
Coding for Scale and Sanity
Coding for Scale and SanityCoding for Scale and Sanity
Coding for Scale and Sanity
 
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf
 
Drupal Step-by-Step: How We Built Our Training Site, Part 1
Drupal Step-by-Step: How We Built Our Training Site, Part 1Drupal Step-by-Step: How We Built Our Training Site, Part 1
Drupal Step-by-Step: How We Built Our Training Site, Part 1
 
Drupal 8: Routing & More
Drupal 8: Routing & MoreDrupal 8: Routing & More
Drupal 8: Routing & More
 
Building Large jQuery Applications
Building Large jQuery ApplicationsBuilding Large jQuery Applications
Building Large jQuery Applications
 
First Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentFirst Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven Development
 
Dojo Confessions
Dojo ConfessionsDojo Confessions
Dojo Confessions
 
JavaScript in Drupal 7: What developers need to know
JavaScript in Drupal 7: What developers need to knowJavaScript in Drupal 7: What developers need to know
JavaScript in Drupal 7: What developers need to know
 
Views notwithstanding
Views notwithstandingViews notwithstanding
Views notwithstanding
 
Drupal 8 Sample Module
Drupal 8 Sample ModuleDrupal 8 Sample Module
Drupal 8 Sample Module
 
Functionality Focused Code Organization
Functionality Focused Code OrganizationFunctionality Focused Code Organization
Functionality Focused Code Organization
 
Routing in Drupal 8
Routing in Drupal 8Routing in Drupal 8
Routing in Drupal 8
 
Dependency injection - phpday 2010
Dependency injection - phpday 2010Dependency injection - phpday 2010
Dependency injection - phpday 2010
 
Goodbye hook_menu() - Routing and Menus in Drupal 8
Goodbye hook_menu() - Routing and Menus in Drupal 8Goodbye hook_menu() - Routing and Menus in Drupal 8
Goodbye hook_menu() - Routing and Menus in Drupal 8
 

Semelhante a Drupal is Stupid (But I Love It Anyway)

You code sucks, let's fix it
You code sucks, let's fix itYou code sucks, let's fix it
You code sucks, let's fix itRafael Dohms
 
What's new in the Drupal 7 API?
What's new in the Drupal 7 API?What's new in the Drupal 7 API?
What's new in the Drupal 7 API?Alexandru Badiu
 
SPL: The Missing Link in Development
SPL: The Missing Link in DevelopmentSPL: The Missing Link in Development
SPL: The Missing Link in Developmentjsmith92
 
Undercover Pods / WP Functions
Undercover Pods / WP FunctionsUndercover Pods / WP Functions
Undercover Pods / WP Functionspodsframework
 
Development Approach
Development ApproachDevelopment Approach
Development Approachalexkingorg
 
Form API Intro
Form API IntroForm API Intro
Form API IntroJeff Eaton
 
Zf Zend Db by aida
Zf Zend Db by aidaZf Zend Db by aida
Zf Zend Db by aidawaraiotoko
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistenceHugo Hamon
 
Doctrine 2
Doctrine 2Doctrine 2
Doctrine 2zfconfua
 
Drupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionDrupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionPhilip Norton
 
Aura Project for PHP
Aura Project for PHPAura Project for PHP
Aura Project for PHPHari K T
 
Object Oriented Programming in PHP
Object Oriented Programming in PHPObject Oriented Programming in PHP
Object Oriented Programming in PHPLorna Mitchell
 
dcs plus Catalogue 2015
dcs plus Catalogue 2015dcs plus Catalogue 2015
dcs plus Catalogue 2015dcs plus
 
Learning the basics of the Drupal API
Learning the basics of the Drupal APILearning the basics of the Drupal API
Learning the basics of the Drupal APIAlexandru Badiu
 
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 JavascriptjQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 JavascriptDarren Mothersele
 
JavaScript in Drupal 7: What developers need to know
JavaScript in Drupal 7: What developers need to knowJavaScript in Drupal 7: What developers need to know
JavaScript in Drupal 7: What developers need to knowWork at Play
 
15. CodeIgniter editarea inregistrarilor
15. CodeIgniter editarea inregistrarilor15. CodeIgniter editarea inregistrarilor
15. CodeIgniter editarea inregistrarilorRazvan Raducanu, PhD
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ EtsyNishan Subedi
 

Semelhante a Drupal is Stupid (But I Love It Anyway) (20)

You code sucks, let's fix it
You code sucks, let's fix itYou code sucks, let's fix it
You code sucks, let's fix it
 
What's new in the Drupal 7 API?
What's new in the Drupal 7 API?What's new in the Drupal 7 API?
What's new in the Drupal 7 API?
 
SPL: The Missing Link in Development
SPL: The Missing Link in DevelopmentSPL: The Missing Link in Development
SPL: The Missing Link in Development
 
Feeds drupal cafe
Feeds drupal cafeFeeds drupal cafe
Feeds drupal cafe
 
Undercover Pods / WP Functions
Undercover Pods / WP FunctionsUndercover Pods / WP Functions
Undercover Pods / WP Functions
 
Development Approach
Development ApproachDevelopment Approach
Development Approach
 
Form API Intro
Form API IntroForm API Intro
Form API Intro
 
Zf Zend Db by aida
Zf Zend Db by aidaZf Zend Db by aida
Zf Zend Db by aida
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistence
 
Doctrine 2
Doctrine 2Doctrine 2
Doctrine 2
 
Drupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionDrupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency Injection
 
Aura Project for PHP
Aura Project for PHPAura Project for PHP
Aura Project for PHP
 
Object Oriented Programming in PHP
Object Oriented Programming in PHPObject Oriented Programming in PHP
Object Oriented Programming in PHP
 
OOPs Concept
OOPs ConceptOOPs Concept
OOPs Concept
 
dcs plus Catalogue 2015
dcs plus Catalogue 2015dcs plus Catalogue 2015
dcs plus Catalogue 2015
 
Learning the basics of the Drupal API
Learning the basics of the Drupal APILearning the basics of the Drupal API
Learning the basics of the Drupal API
 
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 JavascriptjQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
 
JavaScript in Drupal 7: What developers need to know
JavaScript in Drupal 7: What developers need to knowJavaScript in Drupal 7: What developers need to know
JavaScript in Drupal 7: What developers need to know
 
15. CodeIgniter editarea inregistrarilor
15. CodeIgniter editarea inregistrarilor15. CodeIgniter editarea inregistrarilor
15. CodeIgniter editarea inregistrarilor
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ Etsy
 

Último

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 

Último (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 

Drupal is Stupid (But I Love It Anyway)

  • 1. Drupal is Stupid (But I Love It Anyway) Thursday, November 10, 11
  • 2. oh hai • Brock Boland, Jackson River • @brock • brock@brockboland.com • GoSpringboard.com Thursday, November 10, 11
  • 3. Plan • Drupal Overview • What sucks • What’s awesome Thursday, November 10, 11
  • 4. Drupal • Open Source CMS • 6 vs. 7 • Hook system • Theme functions • Contrib modules Thursday, November 10, 11
  • 6. Core doesn’t do much Thursday, November 10, 11
  • 7. Animal Fun Fact #1 Thursday, November 10, 11
  • 8. Animal Fun Fact #1 Source: http://blogs.dixcdn.com/shine_a_light/2011/02/02/love-birds/ Thursday, November 10, 11
  • 9. Catch-all Hooks • hook_block() • list, configure, save, view • hook_taxonomy() • delete, insert, update • hook_comment() • insert, update, view, validate, publish, unpublish, delete • hook_nodeapi() • alter, delete, delete revision, insert, load, prepare, print, rss item, search result, presave, update, update index, validate, view Thursday, November 10, 11
  • 11. DB Layer • Uses straight SQL queries • db_query() and db_query_range() • db_fetch_object() or db_fetch_array() • drupal_write_record() Thursday, November 10, 11
  • 12. D6 db_query("UPDATE {node_type} SET type = '%s', name = '%s', module = '%s', has_title = %d, title_label = '%s', has_body = %d, body_label = '%s', description = '%s', help = '%s', min_word_count = %d, custom = %d, modified = %d, locked = %d WHERE type = '%s'", $info->type, $info->name, $info->module, $info->has_title, $info- >title_label, $info->has_body, $info->body_label, $info->description, $info->help, $info->min_word_count, $info- >custom, $info->modified, $info->locked, $existing_type); D7 $fields = array( else { 'type' => (string) $type->type, $fields['orig_type'] = (string) $type- 'name' => (string) $type->name, >orig_type; 'base' => (string) $type->base, db_insert('node_type') 'has_title' => (int) $type->has_title, ->fields($fields) 'title_label' => (string) $type->title_label, ->execute(); 'description' => (string) $type->description, 'help' => (string) $type->help, field_attach_create_bundle('node', $type- 'custom' => (int) $type->custom, >type); 'modified' => (int) $type->modified, 'locked' => (int) $type->locked, module_invoke_all('node_type_insert', $type); 'disabled' => (int) $type->disabled, $status = SAVED_NEW; 'module' => $type->module, } ); if ($is_existing) { db_update('node_type') ->fields($fields) ->condition('type', $existing_type) ->execute(); if (!empty($type->old_type) && $type- >old_type != $type->type) { field_attach_rename_bundle('node', $type- >old_type, $type->type); } module_invoke_all('node_type_update', $type); $status = SAVED_UPDATED; } Thursday, November 10, 11
  • 13. Animal Fun Fact #2 Source: http://schoolworkhelper.net/2011/06/wolves-habitat-characteristics-behaviors/ Thursday, November 10, 11
  • 14. Animal Fun Fact #2 Source: http://www.indyposted.com/135755/sarah-palin-hunting-clip-offends-some-over-animal-abuse-others-over-poor-hunting-skills-video/sarah-palin-hunting-2/ Thursday, November 10, 11
  • 15. Multiple Implementation Options Thursday, November 10, 11
  • 18. DIY function ahah_callback_method() { // AHAH processing prep $form_state = array('storage' => NULL, 'submitted' => FALSE); $form_build_id = $_POST['form_build_id']; $form = form_get_cache($form_build_id, $form_state); $args = $form['#parameters']; $form_id = array_shift($args); $form_state['post'] = $form['#post'] = $_POST; $form['#programmed'] = $form['#redirect'] = FALSE; drupal_process_form($form_id, $form, $form_state); $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id); // Now you can do stuff } Thursday, November 10, 11
  • 19. ahah_helper module /** // $form_state['submit_handlers'] and $form_state['validate_handlers']. * Given a POST of a Drupal form (with both a form_build_id set), this // This problem does not exist when AHAH is disabled, because then the * function rebuilds the form and then only renders the given form item. If no // assumption is true, and then you generally provide a button as an * form item is given, the entire form is rendered. // alternative to the AHAH behavior. * $form_state['submitted'] = TRUE; * Is used directly in a menu callback in ahah_helper's sole menu item. Can // Continued from the above: when an AHAH update of the form is triggered * also be used in more advanced menu callbacks, for example to render // without using a button, you generally don't want any validation to kick * multiple form items of the same form and return them separately. // in. A typical example is adding new fields, possibly even required ones. * // You don't want errors to be thrown at the user until they actually submit * @param $parents // their values. (Well, actually you want to be smart about this: sometimes */ // you do want instant validation, but that's an even bigger pain to solve function ahah_helper_render($form_item_to_render = FALSE) { // here so I'll leave that for later…) $form_state = array('storage' => NULL, 'submitted' => FALSE); if (!isset($_POST['op'])) { $form_build_id = $_POST['form_build_id']; // For the default "{$form_id}_validate" and "{$form_id}_submit" handlers. $form['#validate'] = NULL; // Get the form from the cache. $form['#submit'] = NULL; $form = form_get_cache($form_build_id, $form_state); // For customly set #validate and #submit handlers. $args = $form['#parameters']; $form_state['submit_handlers'] = NULL; $form_id = array_shift($args); $form_state['validate_handlers'] = NULL; // Disable #required and #element_validate validation. // Are we on the node form? _ahah_helper_disable_validation($form); $node_form = FALSE; } if (preg_match('/_node_form$/', $form_id)) { $node_form = TRUE; // Build, validate and if possible, submit the form. module_load_include('inc', 'node', 'node.pages'); drupal_process_form($form_id, $form, $form_state); } if ($node_form) { // get the node from the submitted values // We will run some of the submit handlers so we need to disable redirecting. $node = node_form_submit_build_node($form, $form_state); $form['#redirect'] = FALSE; // We need to process the form, prepare for that by setting a few internals // hack to stop taxonomy from resetting when the form is rebuilt // variables. $form_state['node']['taxonomy'] = taxonomy_preview_terms($node); $form['#post'] = $_POST; } $form['#programmed'] = FALSE; $form_state['post'] = $_POST; // This call recreates the form relying solely on the form_state that the // drupal_process_form set up. // $form_state['storage']['#ahah_helper']['file'] has been set, to know //$form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id); // which file should be loaded. This is necessary because we'll use the form $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id); // definition itself rather than the cached $form. if (isset($form_state['storage']['#ahah_helper']['file'])) { // Get the form item we want to render. require_once($form_state['storage']['#ahah_helper']['file']); $form_item = _ahah_helper_get_form_item($form, $form_item_to_render); } // Get the JS settings so we can merge them. // If the form is being rebuilt due to something else than a pressed button, $javascript = drupal_add_js(NULL, NULL, 'header'); // e.g. a select that was changed, then $_POST['op'] will be empty. As a $settings = call_user_func_array('array_merge_recursive', // result, Forms API won't be able to detect any pressed buttons. Eventually $javascript['setting']); // it will call _form_builder_ie_cleanup(), which will automatically, yet // inappropriately assign the first in the form as the clicked button. The drupal_json(array( // reasoning is that since the form has been submitted, a button surely must 'status' => TRUE, // have been clicked. This is of course an invalid reasoning in the context 'data' => theme('status_messages') . drupal_render($form_item), // of AHAH forms. 'settings' => array('ahah' => $settings['ahah']), // To work around this, we *always* set $form_state['submitted'] to true, )); // this will prevent _form_builder_ie_cleanup() from assigning a wrong } // button. When a button is pressed (thus $_POST['op'] is set), then this // button will still set $form_state['submitted'], Thursday, November 10, 11
  • 20. Assumes You Want an HTML Page Thursday, November 10, 11
  • 21. Animal Fun Fact #3 Source: http://www.dailymail.co.uk/travel/article-1320804/Mountain-goats-climb-160ft-near-vertical-Cingino-dam.html Thursday, November 10, 11
  • 22. Animal Fun Fact #3 Source: http://www.dailymail.co.uk/travel/article-1320804/Mountain-goats-climb-160ft-near-vertical-Cingino-dam.html Thursday, November 10, 11
  • 30. Always Need Custom Module(s) Thursday, November 10, 11
  • 33. Misc. Crap • HTML5 • Mobile • Configuration Management • Content Migration Thursday, November 10, 11
  • 34. Still? Pretty Awesome Thursday, November 10, 11
  • 39. On the Whole? • Stupid • Getting better • Still not going to use anything else Thursday, November 10, 11
  • 40. Questions? Which is funnier: Pirate Monkey, or Aviator Monkey? jacksonriver.com/monkeys Thursday, November 10, 11
  • 41. Once more • Brock Boland • @brock • brock@brockboland.com Thursday, November 10, 11