Dear all,

The readme file say:

The Galleria player support title and description for each gallery item. By default, item title is the atom title, but it can be overriden locally in the gallery.

Unfortunately, I cannot find the way to display the author name next the image title.

I really like Scald Gallery, indeed it makes me feel a bit stupid sometime! Could any one help me to feel more comfortable with myself?

Comments

gifad’s picture

It's kind of a translation issue :
“it can be overriden locally” means that you must type manually the desired title for all the images of the gallery...

You can replace “type” by “copy/paste” using following steps :

  • Make an **image** context (not gallery context), with image-style transcoder, and html5 player
  • In this player “Player settings”, adjust the “Text pattern used for caption” to your taste
  • Go to the Gallery “manage display", select the above context for the “Gallery items” format

Now, when editing gallery, the above defined “caption” should be ready for copying (see attached screen shot), so it's just 2 seconds per image...

Having a small “copy” button would be great, and perhaps easyer to implement than “use gallery-items tokens” in Galleria player settings.
((To be posted soon by jcisio
please open new issue and post a patch.
;))

jcisio’s picture

Exactly! The proper fix will be token support in the Galleria player so that
1/ you don't have to modify the overridden title when you edit the atom title
2/ not only title but also description can use token: you can use a field on the atom as the gallery item description

gifad’s picture

I finally made a patch, but for my sandbox project “Scald Gallery Extras”;

Alternatively, the following snippet can be included in any enabled module, provided it executes after scald_gallery's sibling alter.

function {yourmodule}_field_widget_atom_reference_textfield_form_alter(&$element, &$form_state, $context) {
  // Only alter gallery field gallery_items.
  if (!isset($context['form']['#entity'])) {
    return;
  }
  if ($context['instance']['entity_type'] !== 'scald_atom') {
    return;
  }
  $atom = $context['form']['#entity'];
  if ($atom->type !== 'gallery' || $atom->provider !== 'scald_gallery') {
    return;
  }

  if ($context['delta'] >= count($context['items'])) {
    // New empty element.
    return;
  }

  if (!isset($element['title_overriden']['#default_value'])) {
    drupal_set_message("This hook must run *after* scald_gallery");
    return;
  }

  $sid = $context['items'][$context['delta']]['sid'];
  $item = NULL;
  if ($element['title_overriden']['#default_value'] == 0) {
    if (!$item)
      $item = scald_fetch($sid);
     if(!empty($item->scald_authors['und']['0']['tid'])) {
      $term = taxonomy_term_load($item->scald_authors['und']['0']['tid']);
      $name = $term->name;
      $element['title_overriden']['#default_value'] = 1;
      $element['title']['#default_value'] = $item->title.', '.t('by').' '.$name;
    }
  }
  if (empty($element['description']['#default_value'])) {
    if (!$item)
      $item = scald_fetch($sid);
    if (isset($item->field_description) && !empty($item->field_description['und']['0']['value']))
      $element['description']['#default_value'] = $item->field_description['und']['0']['value'];
  }
  if ($item)
    unset($item);
}

This could be a patch to scald_galaxy, if some one turns the issue status to “feature request” :)

gifad’s picture

Argh, jcisio posted #2 while I was typing

well, so #3 is a “temporary fix”...

dan_metille’s picture

Thanks a lot to both of you. #3 with gifad Scald Gallery Extras did the work.
Would token support (#2) allow to link the author name to its taxonomy page, or is there maybe an other way to achieve this?

gifad’s picture

You're welcome :)
Looking at my code, I realize it's not multi-language ready (and your site is);
You should probably substitute 'und' by something like $langcode = field_language('scald_atom', $atom, 'scald_authors');

svax’s picture

Issue summary: View changes
StatusFileSize
new2.74 KB

I would also like to see a better way to display the author when browsing the gallery. I'm currently using this patch, but I guess support for tokens would be a better solution.

nagy.balint’s picture

There was some work on the authors in this issue: https://www.drupal.org/node/2428547 which is already in the latest release.
Maybe that version could be extended if further features are needed.