I have a date view which has a contextual filter for years, and am using it to show a summary list of years. In the summary, it's putting an 'undated' option at the bottom of the summary. I don't have any undated content, and anyway, the undated option just links to the wildcard argument. I can't figure out how to disable the 'undated' option. Removing the wildcard argument doesn't change anything. What am I missing?

Comments

elly’s picture

Bueller?

star-szr’s picture

Title: How to get rid of 'undated' option in summary views? » Remove or optionally include 'Undated' option in summary views
Component: Views Filter » Views Argument
Category: support » feature

I couldn't find any option to remove this either. In the end I figured out that I did actually have an undated piece of content which came from a Feeds import. Deleting that piece of content also removed the "Undated" item from my summary view.

The fact that "Undated" just shows all content seems to defeat the purpose of even having an "Undated" option to me, so moving to feature request.

I've included a quick fix if you can't seem to get rid of Undated. Substitute articles for your view's machine name and block_article_archives for your view display's machine name (Advanced > Other > Machine Name). You can add this code to your theme's template.php or in a custom module, be sure to change MYTHEME to your theme or module name and clear your cache.

Also, if your summary is being sorted ascending, substitute array_shift() for array_pop().

/**
 * Implements hook_views_pre_render().
 */
function MYTHEME_views_pre_render(&$view) {
  // Remove 'Undated' option from date summary view.
  if ($view->name == 'articles' && $view->current_display == 'block_article_archives') {
    array_pop($view->result);
  }
}
star-szr’s picture

Issue summary: View changes

clarifying