I created a module that uses the standard Drupal file attachments instead of a CCK ImageField which should be easy to integrate with your module. With the addition there is no required dependency anymore to CCK, a simple Drupal node with some files attached is sufficient.

Let me know if you're interrested, then I will provide a patch for you against HEAD.

(btw, the only modification to your module I had to make was removing the CCK dependency, as I dont use CCK)

Comments

nvoyageur’s picture

This sounds interesting, do you have a working example?

Anonymous’s picture

Yep, you can take a look at it here:

http://unlimiteddesigncontest.nl/en/category/form

The top section (with fading images) is a node with image attachments. This is mostly accomplished by the following piece of code:


function theme_udc_slideshow( $node ) {
  
  if (!variable_get('udc_slideshow_'. $node->type, FALSE)) {
    return;
  }
  
  $preset = variable_get('udc_slideshow_preset_'. $node->type, 0 );
  $jq_slideshow_id = 'jq-slideshow-'. $node->nid;
  
  $output = '<div class="jquery_slideshow" id="'. $jq_slideshow_id .'">';
  
  foreach ($node->files as $file) {
    $output .= theme('imagecache', $preset, $file->filepath, $file->description, $file->description);        
  }

  $output .= '</div>';
  
  _jquery_slideshow_get_settings($jq_slideshow_id, $preset);
  
  return $output;
}

And some config settings on the content element's settings page:


function udc_slideshow_form_alter(&$form, &$form_state, $form_id) {
  
  if ($form_id == 'node_type_form' && isset ($form['identity']['type'])) {

    $imagecache_presets = array ( 0 => t('-- Select preset --'));
    foreach (_jquery_slideshow_get_presets() as $preset) {
      $imagecache_presets[$preset] = str_replace('_', ' ', $preset);
    }
    
    $form['udc_slideshow'] = array(
      '#type' => 'fieldset',
      '#title' => t('Slideshow'),
      '#collapsible' => TRUE,
      '#collapsed' => !variable_get( 'udc_slideshow_'. $form['#node_type']->type, 0 ),
    );
    if (empty ($imagecache_presets)) {
      $form['udc_slideshow']['message'] = array (
        '#value' => t('You need to configure at lease one Imagecache preset first!')
      );
    } 
    else {
      $form['udc_slideshow']['udc_slideshow'] = array (
        '#type' => 'checkbox',
        '#title' => t('Enable slideshow'),
        '#default_value' => variable_get( 'udc_slideshow_'. $form['#node_type']->type, 0 ),
        '#return_value' => 1,
        '#weight' => -5,
      );
      $form['udc_slideshow']['udc_slideshow_preset'] = array(
        '#type' => 'select',
        '#title' => t('Imagecache preset'),
        '#options' => $imagecache_presets,
        '#default_value' => variable_get('udc_slideshow_preset_'. $form['#node_type']->type, 0 ),
        '#weight' => -4,
        '#required' => TRUE,
      );
    }
    
    $form['#submit'][] = 'udc_slideshow_node_type_form_submit';
  }
}

It should be fairly easy to integrate this with the jquery_slideshow module, or provide it as a contributed submodule.

nvoyageur’s picture

If this was made a sub-module, then I'm sure how we would get around the requirements for CCK and ImageField for the main module. Any ideas?