I had set up a view whereby I would be adding the title in a separate div. Prior to the latest beta releases of views (and subsequently prior to the latest dev releases), this was working. However, it has now stopped working so when viewing a page, it instead shows [field_content_associated_images-title]-[field_content_associated_images-alt]. The tokens are available via the views ui, just to be clear. I'm trying to narrow down the issue and hopefully come up with what might be causing the issue but below is how the view has been set up:

$view = new view;
$view->name = 'event_gallery_image_slideshow';
$view->description = 'Image Gallery Slideshow';
$view->tag = '';
$view->base_table = 'node';
$view->human_name = 'Associated Image Cycle';
$view->core = 7;
$view->api_version = '3.0-alpha1';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['title'] = 'Attached Node Image Gallery';
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['style_plugin'] = 'slideshow';
$handler->display->display_options['style_options']['slideshow_type'] = 'views_slideshow_cycle';
$handler->display->display_options['style_options']['slideshow_skin'] = 'default';
$handler->display->display_options['style_options']['skin_info'] = array(
  'class' => 'default',
  'name' => 'Default',
  'module' => 'views_slideshow',
  'path' => '',
  'stylesheets' => array(),
);
$handler->display->display_options['style_options']['widgets']['top']['views_slideshow_pager']['weight'] = '1';
$handler->display->display_options['style_options']['widgets']['top']['views_slideshow_pager']['type'] = 'views_slideshow_pager_fields';
$handler->display->display_options['style_options']['widgets']['top']['views_slideshow_pager']['views_slideshow_pager_fields_fields'] = array(
  'entity_id' => 0,
  'field_content_associated_images' => 0,
);
$handler->display->display_options['style_options']['widgets']['top']['views_slideshow_controls']['weight'] = '1';
$handler->display->display_options['style_options']['widgets']['top']['views_slideshow_controls']['type'] = 'views_slideshow_controls_text';
$handler->display->display_options['style_options']['widgets']['top']['views_slideshow_slide_counter']['weight'] = '1';
$handler->display->display_options['style_options']['widgets']['bottom']['views_slideshow_pager']['weight'] = '1';
$handler->display->display_options['style_options']['widgets']['bottom']['views_slideshow_pager']['type'] = 'views_slideshow_pager_fields';
$handler->display->display_options['style_options']['widgets']['bottom']['views_slideshow_pager']['views_slideshow_pager_fields_fields'] = array(
  'entity_id' => 0,
  'field_content_associated_images' => 0,
);
$handler->display->display_options['style_options']['widgets']['bottom']['views_slideshow_controls']['weight'] = '1';
$handler->display->display_options['style_options']['widgets']['bottom']['views_slideshow_controls']['type'] = 'views_slideshow_controls_text';
$handler->display->display_options['style_options']['widgets']['bottom']['views_slideshow_slide_counter']['weight'] = '1';
$handler->display->display_options['style_options']['views_slideshow_cycle']['timeout'] = '5000';
$handler->display->display_options['style_options']['views_slideshow_cycle']['speed'] = '700';
$handler->display->display_options['style_options']['views_slideshow_cycle']['delay'] = '0';
$handler->display->display_options['style_options']['views_slideshow_cycle']['start_paused'] = 0;
$handler->display->display_options['style_options']['views_slideshow_cycle']['remember_slide_days'] = '1';
$handler->display->display_options['style_options']['views_slideshow_cycle']['items_per_slide'] = '1';
$handler->display->display_options['style_options']['views_slideshow_cycle']['cleartype'] = 0;
$handler->display->display_options['style_options']['views_slideshow_cycle']['cleartypenobg'] = 0;
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['row_options']['hide_empty'] = 0;
/* Field: Content: Nid */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'node';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
$handler->display->display_options['fields']['nid']['label'] = '';
$handler->display->display_options['fields']['nid']['exclude'] = TRUE;
$handler->display->display_options['fields']['nid']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['nid']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['nid']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['nid']['alter']['external'] = 0;
$handler->display->display_options['fields']['nid']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['nid']['alter']['trim'] = 0;
$handler->display->display_options['fields']['nid']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['nid']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['nid']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['nid']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['nid']['alter']['html'] = 0;
$handler->display->display_options['fields']['nid']['element_label_colon'] = 0;
$handler->display->display_options['fields']['nid']['element_default_classes'] = 1;
$handler->display->display_options['fields']['nid']['hide_empty'] = 0;
$handler->display->display_options['fields']['nid']['empty_zero'] = 0;
$handler->display->display_options['fields']['nid']['link_to_node'] = 0;
/* Field: Associated Image */
$handler->display->display_options['fields']['entity_id']['id'] = 'entity_id';
$handler->display->display_options['fields']['entity_id']['table'] = 'field_data_field_content_associated_images';
$handler->display->display_options['fields']['entity_id']['field'] = 'field_content_associated_images';
$handler->display->display_options['fields']['entity_id']['ui_name'] = 'Associated Image';
$handler->display->display_options['fields']['entity_id']['label'] = '';
$handler->display->display_options['fields']['entity_id']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['external'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['trim'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['entity_id']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['entity_id']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['html'] = 0;
$handler->display->display_options['fields']['entity_id']['element_label_colon'] = 0;
$handler->display->display_options['fields']['entity_id']['element_wrapper_type'] = 'span';
$handler->display->display_options['fields']['entity_id']['element_default_classes'] = 1;
$handler->display->display_options['fields']['entity_id']['hide_empty'] = 0;
$handler->display->display_options['fields']['entity_id']['empty_zero'] = 0;
$handler->display->display_options['fields']['entity_id']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['entity_id']['settings'] = array(
  'image_style' => 'large',
  'image_link' => '',
);
$handler->display->display_options['fields']['entity_id']['group_rows'] = 0;
$handler->display->display_options['fields']['entity_id']['delta_offset'] = '0';
$handler->display->display_options['fields']['entity_id']['delta_reversed'] = 0;
$handler->display->display_options['fields']['entity_id']['field_api_classes'] = 0;
/* Field: Associated Image Title Text */
$handler->display->display_options['fields']['field_content_associated_images']['id'] = 'field_content_associated_images';
$handler->display->display_options['fields']['field_content_associated_images']['table'] = 'field_data_field_content_associated_images';
$handler->display->display_options['fields']['field_content_associated_images']['field'] = 'field_content_associated_images';
$handler->display->display_options['fields']['field_content_associated_images']['ui_name'] = 'Associated Image Title Text';
$handler->display->display_options['fields']['field_content_associated_images']['label'] = '';
$handler->display->display_options['fields']['field_content_associated_images']['alter']['alter_text'] = 1;
$handler->display->display_options['fields']['field_content_associated_images']['alter']['text'] = '<div class="associated-image-cycle-text">[field_content_associated_images-title]-[field_content_associated_images-alt]</div>';
$handler->display->display_options['fields']['field_content_associated_images']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['field_content_associated_images']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['field_content_associated_images']['alter']['external'] = 0;
$handler->display->display_options['fields']['field_content_associated_images']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['field_content_associated_images']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_content_associated_images']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['field_content_associated_images']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_content_associated_images']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_content_associated_images']['alter']['strip_tags'] = 1;
$handler->display->display_options['fields']['field_content_associated_images']['alter']['preserve_tags'] = '<div>';
$handler->display->display_options['fields']['field_content_associated_images']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_content_associated_images']['element_label_colon'] = 0;
$handler->display->display_options['fields']['field_content_associated_images']['element_default_classes'] = 1;
$handler->display->display_options['fields']['field_content_associated_images']['hide_empty'] = 0;
$handler->display->display_options['fields']['field_content_associated_images']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_content_associated_images']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['field_content_associated_images']['settings'] = array(
  'image_style' => '',
  'image_link' => '',
);
$handler->display->display_options['fields']['field_content_associated_images']['group_rows'] = 0;
$handler->display->display_options['fields']['field_content_associated_images']['delta_offset'] = '0';
$handler->display->display_options['fields']['field_content_associated_images']['delta_reversed'] = 0;
$handler->display->display_options['fields']['field_content_associated_images']['field_api_classes'] = 0;
/* Contextual filter: Content: Nid */
$handler->display->display_options['arguments']['nid']['id'] = 'nid';
$handler->display->display_options['arguments']['nid']['table'] = 'node';
$handler->display->display_options['arguments']['nid']['field'] = 'nid';
$handler->display->display_options['arguments']['nid']['default_action'] = 'default';
$handler->display->display_options['arguments']['nid']['exception']['title_enable'] = 1;
$handler->display->display_options['arguments']['nid']['default_argument_type'] = 'node';
$handler->display->display_options['arguments']['nid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['nid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['nid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['nid']['break_phrase'] = 0;
$handler->display->display_options['arguments']['nid']['not'] = 0;

/* Display: Attached Node Image Gallery */
$handler = $view->new_display('entity_view', 'Attached Node Image Gallery', 'entity_view_1');
$handler->display->display_options['entity_type'] = 'node';
$handler->display->display_options['bundles'] = array(
  0 => 'page',
  1 => 'gallery_exhibition',
  2 => 'redcat_event',
);
$translatables['event_gallery_image_slideshow'] = array(
  t('Defaults'),
  t('Attached Node Image Gallery'),
  t('more'),
  t('Apply'),
  t('Reset'),
  t('Sort by'),
  t('Asc'),
  t('Desc'),
  t('<div class="associated-image-cycle-text">[field_content_associated_images-title]-[field_content_associated_images-alt]</div>'),
  t('All'),
);

BTW, I know the views api version shows '3.0-alpha1'; however, I noticed that the function views_api_version returns that value in views7-beta3 so I just want to assert that I am using the correct version.

CommentFileSizeAuthor
#5 1109532_is_scalar_fix_btmash_4.patch733 bytesbtmash

Comments

dawehner’s picture

Status: Active » Closed (duplicate)

The api version is the right version.

We don't provide are token which were provided in 6.x
See #1052774: Show Title / Alt fields of an image field for an example duplicate issue.

btmash’s picture

I guess I'm a bit confused since views seems to imply that the tokens *are* there (they show up in the views ui and my understanding is that it is coming from the following functions which are in views_handler_field_field.inc

  function document_self_tokens(&$tokens) {
    $field = $this->field_info;
    foreach ($field['columns'] as $id => $column) {
      $tokens['[' . $this->options['id'] . '-' . $id . ']'] = t('Raw @column', array('@column' => $id));
    }
  }

  function add_self_tokens(&$tokens, $item) {
    $field = $this->field_info;
    foreach ($field['columns'] as $id => $column) {
      // Use filter_xss_admin because it's user data and we can't be sure it is safe.
      // We know nothing about the data, though, so we can't really do much else.
      if (isset($item['raw']) && is_scalar($item['raw'])) {
        $tokens['[' . $this->options['id'] . '-' . $id . ']'] = filter_xss_admin($item['raw'][$id]);
      }
    }
  }

And as I'd mentioned, this was working in previous versions of the dev branch of views (between the alpha and beta versions in dev w/ the new ui)

btmash’s picture

Status: Closed (duplicate) » Active

I have to open this back up because it seems like it is stemming from #1064290: Views field rewrite causes problem with drupal_validate_utf8. When the is_scalar check is removed, it seems to work again. So either the self documenting tokens should be revised to not include any other field columns from the field api or this aspect needs further inspection.

btmash’s picture

Status: Active » Needs review

Seems like the original check in add_self_tokens was

      if (isset($item['raw']) && is_scalar($item['raw'])) {
        $tokens['[' . $this->options['id'] . '-' . $id . ']'] = filter_xss_admin($item['raw'][$id]);
      }

I believe it should be

      if (isset($item['raw']) && is_scalar($item['raw'][$id])) {
        $tokens['[' . $this->options['id'] . '-' . $id . ']'] = filter_xss_admin($item['raw'][$id]);
      }

since filter_xss_admin is running on $id and not on 'raw' which would be an array and thus fail the is_scalar check.

btmash’s picture

StatusFileSize
new733 bytes

Forgot to add it in patch format

merlinofchaos’s picture

Status: Needs review » Fixed

Committed and pushed. I think this will fix a few issues.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.