Drupal, Flickr and a photo gallery part 4

Having gone through the the specifics of the interesting parts of this module, this article shows how it all comes together.

You can find the code for this module in its sandbox on drupal.org. To download it follow the sandbox instructions.

The module follows the usual way:

  • quickgallery_menu sets up the gallery index at a URL.

  • quickgallery_page gets called to generate the gallery page. If the user doesn't have a gallery and the module can't work out how to get the user started it displays instructions, otherwise the node create form is shown.

  • quickgallery_get_nsid_sets gets a list of flickr sets owned by the logged in user.

  • quickgallery_add_form is a form for adding a new gallery, this isn't used much, it is there as an alternative to the node add form.

  • quickgallery_add_form_validate/quickgallery_add_form_submit process the output of quickgallery_add_form. It creates a new gallery node.

  • quickgallery_theme connects up the theme template files quickgallery.tpl.php and quickgblock.tpl.php.

  • quickgallery_block creates a block which will only show if the user doesn't yet have a gallery and will encourage them to create one.

  • quickgallery_form_alter makes the node add form ultra simple.

  • quickgallery_edit_form_validate takes the data from the add form (which isn't much because most of it has been removed) and uses the data collected to fill in the required fields which were hidden.

Parts 1, 2 and 3 explain the ins and outs of all of this. Feel free to fork this for your own needs, it isn't the sort of module you could use unmodified. If I wrote an admin interface for it then it could be general purpose but I have no reason to do that right now.
 

 

Site Section: