SlideShare une entreprise Scribd logo
1  sur  41
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

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
 

Tendances (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
 

Similaire à 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
 

Similaire à 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
 

Dernier

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 

Dernier (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

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