plugins/views_plugin_style_jump_menu.inc, line 98

OLD:

foreach ($sets as $title => $records) {
      foreach ($records as $row_index => $row) {

NEW:

foreach ($sets as $title => $records) {
      $rows = isset($records['rows']) ? $records['rows'] : array();
      foreach ($rows as $row_index => $row) {
CommentFileSizeAuthor
#4 1315320-jump_menu_path.patch786 bytesdankobiaka
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

merlinofchaos’s picture

Status: Active » Closed (won't fix)

But that's now the structure $sets should be in. This makes absolutely no sense.

merlinofchaos’s picture

By the way when filing a bug report with a fix, you need to show us what the bug this is fixing actually is, show us how to reproduce it, and show us why your fix is correct.

Also, you need to supply patch files.

dankobiaka’s picture

Within this function $sets contains:

Array
(
    [] => Array
        (
            [group] => 
            [rows] => Array
                (
                    // row data
                )
        )
)

Therefore, the loop is coded incorrectly as it is not configured to loop through the [rows] array, but rather assumes $sets contains an array in this format:

array(
   [group1] => array(),
   [group2] => array()
)

This is obviously incorrect. My solution resolves this issue and now the jump menu works.

To reproduce the error, just create a jump menu WITHOUT GROUPING and you will notice it does not work.

dankobiaka’s picture

FileSize
786 bytes
merlinofchaos’s picture

I don't know how you're seeing that, but that is not the format that render_grouping() returns.


  function render_grouping($records, $grouping_field = '') {
    // Make sure fields are rendered
    $this->render_fields($this->view->result);
    $sets = array();
    if ($grouping_field) {
      foreach ($records as $index => $row) {
        $grouping = '';
        // Group on the rendered version of the field, not the raw.  That way,
        // we can control any special formatting of the grouping field through
        // the admin or theme layer or anywhere else we'd like.
        if (isset($this->view->field[$grouping_field])) {
          $grouping = $this->get_field($index, $grouping_field);
          if ($this->view->field[$grouping_field]->options['label']) {
            $grouping = $this->view->field[$grouping_field]->options['label'] . ': ' . $grouping;
          }
        }
        $sets[$grouping][$index] = $row;
      }
    }
    else {
      // Create a single group with an empty grouping field.
      $sets[''] = $records;
    }
    return $sets;
  }

Nowhere does it make 'groups' or 'rows'.

dankobiaka’s picture

Hmm, mine is different:

  function render_grouping($records, $grouping_field = '', $group_rendered = TRUE) {
    // Make sure fields are rendered
    $this->render_fields($this->view->result);
    $sets = array();
    if ($grouping_field) {
      foreach ($records as $index => $row) {
        $grouping = '';
        // Group on the rendered version of the field, not the raw.  That way,
        // we can control any special formatting of the grouping field through
        // the admin or theme layer or anywhere else we'd like.
        if (isset($this->view->field[$grouping_field])) {
          $group_content = $this->get_field($index, $grouping_field);
          if ($this->view->field[$grouping_field]->options['label']) {
            $group_content = $this->view->field[$grouping_field]->options['label'] . ': ' . $group_content;
          }
          if ($group_rendered) {
            $grouping = $group_content;
          }
          else {
            $grouping = $this->get_field_value($index, $grouping_field);
          }
          if (empty($sets[$grouping]['group'])) {
            $sets[$grouping]['group'] = $group_content;
          }
        }
        $sets[$grouping]['rows'][$index] = $row;
      }
    }
    else {
      // Create a single group with an empty grouping field.
      $sets[''] = array(
        'group' => '',
        'rows' => $records,
      );
    }
    return $sets;
  }
azinck’s picture

Looks like this commit changed it in the dev branch: http://drupalcode.org/project/views.git/commitdiff/a0e16956d080785c8151b...

The new structure is going to break a few modules, methinks.

cpelham’s picture

Priority: Normal » Major
Status: Closed (won't fix) » Active

I just created a new view with a page that displays node titles correctly in unformatted list but a block configured to be a jump menu displays nothing (whether there is grouping or not). Is this the same issue? (Also, in case it is relevant, Quicktabs display plugin no longer displays any data.)

Here is the view with the broken jump menu block:

$view = new view;
$view->name = 'guided_meditation_podcasts';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Guided Meditation Podcasts';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Guided Meditation Podcasts';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
/* Field: Content: Link */
$handler->display->display_options['fields']['field_podcast_link']['id'] = 'field_podcast_link';
$handler->display->display_options['fields']['field_podcast_link']['table'] = 'field_data_field_podcast_link';
$handler->display->display_options['fields']['field_podcast_link']['field'] = 'field_podcast_link';
$handler->display->display_options['fields']['field_podcast_link']['label'] = '';
$handler->display->display_options['fields']['field_podcast_link']['exclude'] = TRUE;
$handler->display->display_options['fields']['field_podcast_link']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['field_podcast_link']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['field_podcast_link']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['field_podcast_link']['alter']['external'] = 0;
$handler->display->display_options['fields']['field_podcast_link']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['field_podcast_link']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['field_podcast_link']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['field_podcast_link']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_podcast_link']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_podcast_link']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['field_podcast_link']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_podcast_link']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_podcast_link']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_podcast_link']['element_default_classes'] = 1;
$handler->display->display_options['fields']['field_podcast_link']['hide_empty'] = 0;
$handler->display->display_options['fields']['field_podcast_link']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_podcast_link']['hide_alter_empty'] = 0;
$handler->display->display_options['fields']['field_podcast_link']['click_sort_column'] = 'url';
$handler->display->display_options['fields']['field_podcast_link']['field_api_classes'] = 0;
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'podcast' => 'podcast',
);

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'guided-meditation-podcasts';

/* Display: Feed */
$handler = $view->new_display('feed', 'Feed', 'feed');
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['style_plugin'] = 'rss';
$handler->display->display_options['row_plugin'] = 'node_rss';
$handler->display->display_options['path'] = 'guided-meditation-podcasts.xml';
$handler->display->display_options['displays'] = array(
  'default' => 'default',
  'page' => 'page',
);

/* Display: Block */
$handler = $view->new_display('block', 'Block', 'block');
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'jump_menu';
$handler->display->display_options['style_options']['path'] = 'nid';
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['defaults']['row_options'] = FALSE;
cpelham’s picture

Dereine just reverted views_plugin_style_inc which resolves this problem. If you know how, go into the repository and grab the current dev of that file. Otherwise, wait for a new dev of Views to come out (sometime tomorrow I expect). This problem was the result of an api that can changed in an attempt to fix another bug. Another approach to fixing that bug will probably be worked on now. It's possible this api could get broken again or maybe they'll find a work around.

cpelham’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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