Drupal - Handle Existing Webform Submission Edits

If you need to do something when a user edits/updates a previous webform submission, try something like this:

Drupal Services Examples

jDrupal: Be sure to check out jDrupal for an easy to use JavaScript Library to communicate with Drupal Services.

This document describes how to read/write entities to/from Drupal using the Services module. It also covers how to handle session authentication. Let's get started...

Drupal JSON Services Examples with PhoneGap and JQuery Mobile for Android

UPDATE: Please read this article for a much more detailed explanation on how to get PhoneGap up and running to communicate with Drupal Services.

Custom Breadcrumbs in Drupal

Aside from the handy dandy Custom Breadcrumbs module and/or using Views arguments to set your breadcrumb, sometimes you just want to set a breadcrumb programmatically on a certain url menu path with phptemplate_breadcrumb, here's how, right now:

Drupal CCK FileField (ImageField) Permissions Granularity

So I had a content type with an optional, unlimited value Imagefield attached to it. The content type's user permissions where set to allow all authenticated users to edit any node of that type. Which is all fine and dandy like sour candy. However, by default users are able to edit and/or remove other user's images in that field. Out-of-the-box that is the intended functionality, but I wanted user's images to be protected from other users. Here is how it can be done with a module:

Drupal URL Arguments in Javascript

Sometimes a prerequisite to getting a burrito for lunch involves using Drupal URL arguments in Javascript. So for example, say you had a URL like this:

You can add code like this to your module:

function my_module_init () {
  drupal_add_js(array('arg' => arg()),'setting');

And finally you can use code like this in Javascript to use the Drupal URL arguments:

Hide Formatting Guidelines on Drupal's Comment Form

Need to hide the formatting guidelines and description that show up by default on Drupal's comment form? Try something like this:

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case "comment_form":
      // begin: hide 'filtered html' input format guidelines and description
      // end

Drupal - Attach a Custom Submit Handler Function to a Form

Need to add a submit handler function to your Drupal form so you can execute some custom code when a form is submitted? Yes? Well then, shuck 'em up partner, try something like this in your module:

Drupal Views Group by Field with Counts

Note, since writing this article I learned about Views Arguments 'action to take if argument not present' summary list with counts... it is definitely easier than the approach I documented below. I'll leave what I have done below because I'm not sure the summary list option will handle all cases. Someday I'll update this post to include a tutorial on how to use the aformentioned approach, someday.


Subscribe to RSS - Code