I'd like to suggest to add the following code to fancybox.module in order to make Ubercart to consider Fancybox as a possible image widget:


/**
 * Implementation of hook_uc_image_widget().
 */
function fancybox_uc_image_widget() {
  $widgets = array();

  $widgets['fancybox'] = array(
    'name' => t('Fancybox'),
    'callback' => 'fancybox_uc_image_widget_impl',
  );

  return $widgets;
}

/**
 * This function generates the fancybox-specific HTML attributes.
 */
function fancybox_uc_image_widget_impl($rel_count) {
  if (!is_null($rel_count)) {
    $img_index = 'uc_image_'. $rel_count;
  }
  else {
    $img_index = 'uc_image';
  }
  return ' class="imagefield-fancybox" rel="'. $img_index .'"';
}

I tried to to push this in Ubercart core (#903118: Fancybox image widget support) but this proposal was rejected. :)

Comments

walktalker’s picture

Thumbs UP for maximpodorov!!
Thank you for the code, and I'm happily using the fancybox with Ubercart Product Image now!

Hopefully this code can be in fancybox next release.