I have built a fairly basic module but i'm struggling with the UX of the admin form. Essentially I need a list of items that have several values; a textfield, checkbox, select list and a button to delete them.

I've built all of the functionality (including the "add one more" using the example in the drupal ajax examples module) and its working great, except now I need to be able to reorder the items and the webmin style up/down buttons are not good UX. I've been hacking to no avail at numerous examples like: http://www.urbaninsight.com/2012/09/11/creating-table-with-draggable-weights-in-drupal-7

It doesn't appear that theme_hook_form is being called so I can't inject the weight javascript, styles or markup.

I added this to the .module file:

function module_cache_theme() {
  return array(
    'theme_module_settings_form' => array(
      'file' => 'module_form.inc',
      'arguments' => array('form' => NULL),

The menu item is in the hook_menu:

  $items['admin/config/development/module'] = array(
    'title' => 'module',
    'description' =>'',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('module_settings_form'),
    'access arguments' => array('administer site configuration'),
    'file' => 'module_form.inc',

When the cache is regenerated I get a dpm message but the method theme_module_settings_form is never being triggered.


2 Answers 2


At the risk of oversimplifying, have you tried using or integrating Draggable Views?

If the items you are sorting are nodes (I'm not clear on this) it is a great option for achieving drag-and-drop sorting as you can assign as many fields to an entity as you'd like and set different sort priorities depending on the circumstances. That as apposed to 'weight' which is a one size fits all number.

  • That is an excellent place for me to start looking. The items are just rows in a purpose built table in the database, they have strings, ints and bool's essentially. I'll have a dig. Feb 26, 2014 at 6:26

Have a look at how Sharerich is implementing it. The example is a CTools integration but it can be applied to any form.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.