Can we have token support for the 'more' link please? Thanks for allowing us to modify the more link text, that helps A LOT!!! But I would love it just that little bit more if I had token functionality, for example...

"Click here to see more articles about %page_title%... "

... for SEO purposes etc.

Thanks
Will Eaton
Drupal Developer
http://www.williameaton.co.uk

Comments

merlinofchaos’s picture

Status: Active » Closed (won't fix)

YOu can accomplish that via theme_views_more which supports all of the usual extras of views theming. So theme_views_more__viewname etc.

fxarte’s picture

For Drupal 7.x views 3.x this is what I used, hopefully it could help you:

/**
  * Implements hook_views_pre_render().
  * Adds token support for see more views blocks
  */
function mymodule_views_pre_render(&$view) {
  //wanted to be as restrictive with this logic as possible.
  if ($view->name =='my_view_name' && FALSE !== array_search($view->current_display, array('my_view_current_display'))) {
    $view->display_handler->default_display->options['use_more_text'] = $view->style_plugin->tokenize_value($view->display_handler->default_display->options['use_more_text'],0);
  }
}
  • $view->display_handler->default_display->options['use_more_text']: contains the more link text
  • style_plugin->tokenize_value: style method to replace views tokens, see: http://api.drupal.org/api/views/handlers!views_handler_field.inc/functio...
  • Use in hook_views_pre_render, when the style plugin is available in the view object.
  • I have no solid reason to use 0 as the second argument. Although the documetnation says it is optional, a warning is produced if not used.
  • As for the value, is the index of the token in the token list, but we dont need it as the tokens definitions is
  • taken from $this->view->build_info['substitutions'], $this is of type style_plugin