This module saves lots of time for me.
everything goes well if use wysiwyg_fields with:
* core image formatter
* custom formatter's "image" formatter preset
* colorbox own formatter preset
However own colorbox preset settings exposed by wysiwyg_fields are too complicated for our users and we want to use simple pre-configured preset.
I have an error with colorbox custom formatter preset:
Undefined index: colorbox_multivalue_index in colorbox_field_formatter_view() (line 446 of /*homefolder*/public_html/drupal/sites/all/modules/colorbox/colorbox.module).
that's my formatter:

$formatter = new stdClass();
$formatter->disabled = FALSE; /* Edit this to true to make a default formatter disabled initially */
$formatter->api_version = 2;
$formatter->name = 'image_with_colorbox';
$formatter->label = 'Картинка с увеличением';
$formatter->description = '';
$formatter->mode = 'formatter_preset';
$formatter->field_types = 'image';
$formatter->code = 'a:2:{s:9:"formatter";s:8:"colorbox";s:8:"settings";a:7:{s:19:"colorbox_node_style";s:6:"medium";s:25:"colorbox_node_style_first";s:0:"";s:20:"colorbox_image_style";s:0:"";s:16:"colorbox_gallery";s:4:"post";s:23:"colorbox_gallery_custom";s:0:"";s:16:"colorbox_caption";s:4:"none";s:23:"colorbox_caption_custom";s:0:"";}}';
$formatter->fapi = '';

Clearing the cache trick from old colorbox issue didn't help.

Comments

fasdalf@fasdalf.ru created an issue.

fasdalf@fasdalf.ru’s picture

for now we use token template [formatted_field-image:colorbox:colorbox_node_style-medium] but i can't figure out how to set a per-comment gallery and how to remove colorbox's titles in token preset.

fasdalf@fasdalf.ru’s picture

Got to use PHP to make a per post/comment gallery with no titles.

$settings = $variables['#display']['settings'];
  $gallery = 'cboxgalery-' . $variables['#obj_type'] . '-';
switch ($variables['#obj_type']) {
    case 'comment':
        $gallery .= $variables['#object']->cid;
        break;
    case 'node':
        $gallery .= $variables['#object']->nid;
        break;
    default:
        echo "i равно 2";
        $gallery .= isset($variables['#object']->changed) ? $variables['#object']->changed : rand();
}
$result = '';
foreach (element_children($variables['#items']) as $delta) {
  $item = $variables['#items'][$delta];
  $source = theme('image_style', array('style_name' => 'medium', 'path' => $item['uri']));
  $result .= l($source, file_create_url($item['uri']), array('html' => TRUE, 'attributes' => array( 'target' => '_blank', 'class' => 'colorbox', 'rel' => $gallery))). ' ';
}
return $result;