Drupal is Stupid (But I Love It Anyway)
Upcoming SlideShare
Loading in...5
×
 

Drupal is Stupid (But I Love It Anyway)

on

  • 1,847 views

Regrettably, my machine didn't cooperate when I tried to record this presentation. I don't think the slides will do you much good without the stuff I said, but a few people asked for them....

Regrettably, my machine didn't cooperate when I tried to record this presentation. I don't think the slides will do you much good without the stuff I said, but a few people asked for them.

---

Depending on who you ask, Drupal is either a framework or a platform, but no matter how you look at it, there are things about it that suck. Hear Brock Boland talk about the pain points of coding for Drupal 6, how things have improved in Drupal 7, and what's expected to be better in Drupal 8.

Statistics

Views

Total Views
1,847
Views on SlideShare
1,847
Embed Views
0

Actions

Likes
1
Downloads
2
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Drupal is Stupid (But I Love It Anyway) Drupal is Stupid (But I Love It Anyway) Presentation Transcript

    • Drupal is Stupid (But I Love It Anyway)Thursday, November 10, 11
    • oh hai • Brock Boland, Jackson River • @brock • brock@brockboland.com • GoSpringboard.comThursday, November 10, 11
    • Plan • Drupal Overview • What sucks • What’s awesomeThursday, November 10, 11
    • Drupal • Open Source CMS • 6 vs. 7 • Hook system • Theme functions • Contrib modulesThursday, November 10, 11
    • StupidThursday, November 10, 11
    • Core doesn’t do muchThursday, November 10, 11
    • Animal Fun Fact #1Thursday, 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, viewThursday, November 10, 11
    • No ObjectsThursday, 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 #2Source: http://schoolworkhelper.net/2011/06/wolves-habitat-characteristics-behaviors/Thursday, November 10, 11
    • Animal Fun Fact #2Source: 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 OptionsThursday, November 10, 11
    • Thursday, November 10, 11
    • Ajax/AHAHThursday, 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_helpers 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 dont 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 dont 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 thats an even bigger pain to solvefunction ahah_helper_render($form_item_to_render = FALSE) { // here so Ill 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 well 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 wont 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 PageThursday, November 10, 11
    • Animal Fun Fact #3 Source: http://www.dailymail.co.uk/travel/article-1320804/Mountain-goats-climb-160ft-near-vertical-Cingino-dam.htmlThursday, November 10, 11
    • Animal Fun Fact #3 Source: http://www.dailymail.co.uk/travel/article-1320804/Mountain-goats-climb-160ft-near-vertical-Cingino-dam.htmlThursday, November 10, 11
    • Steep Learning CurveThursday, November 10, 11
    • Original source unknownThursday, November 10, 11
    • Wonky-ass InterfaceThursday, 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 HandlingThursday, November 10, 11
    • Thursday, November 10, 11
    • Misc. Crap • HTML5 • Mobile • Configuration Management • Content MigrationThursday, November 10, 11
    • Still? Pretty AwesomeThursday, November 10, 11
    • StableThursday, November 10, 11
    • SecureThursday, November 10, 11
    • Contrib ModulesThursday, November 10, 11
    • CommunityThursday, November 10, 11
    • On the Whole? • Stupid • Getting better • Still not going to use anything elseThursday, November 10, 11
    • Questions? Which is funnier: Pirate Monkey, or Aviator Monkey? jacksonriver.com/monkeysThursday, November 10, 11
    • Once more • Brock Boland • @brock • brock@brockboland.comThursday, November 10, 11