Hi,

I have a view with the following argument handling code (it is used in the view to be able to show the content with two taxonomy terms.:

$new_title = '';
if (!$args[0]) return $args;
$new_arg0 = '';
$new_args = explode('-', $args[0]);
foreach ($new_args as $this_arg) {
  if (is_numeric($this_arg)) {
    $new_arg0 .= $new_arg0 == '' ? $this_arg : ','.$this_arg;
  } else {
    $these_terms = taxonomy_get_term_by_name($this_arg);
    if (count($these_terms)) {
      $new_title .= $new_title == '' ? $this_arg : ' - '.$this_arg;
    }
    foreach ($these_terms as $this_term) {
      $new_arg0 .= $new_arg0 == '' ? '' : ',';
      $new_arg0 .= _taxonomy_get_tid_from_term($this_term);
    }
  }
}
if ($new_title) {
  $view->argument[0]['title'] = $new_title;
}
return array($new_arg0);

The view will not save in the Panel!
greetings,
Martijn

CommentFileSizeAuthor
#6 select_taxononoy_test.jpg14.39 KBsummit
#6 panel_pane.jpg57.07 KBsummit

Comments

summit’s picture

On second thought..the one view with this argument handling code works....another is not working.
I have to get into this deeper.

I got this error on both views:

warning: Invalid argument supplied for foreach() in /home/public_html/modules/panels/includes/plugins.inc on line 582.

greetings,
Martijn

summit’s picture

OK,
What I did is trying to make the taxonomy/term view "two" terms enabled. This works within the view-scope. But this is not working within the panel-scope. The view itself will not save.
I show the specific view underneath:

  $view = new stdClass();
  $view->name = 'taxonomy_test';
  $view->description = 'The taxonomy view with a depth of 0.';
  $view->access = array (
);
  $view->view_args_php = 'new_title = \'\';
if (!$args[0]) return $args;
$new_arg0 = \'\';
$new_args = explode(\'-\', $args[0]);
foreach ($new_args as $this_arg) {
  if (is_numeric($this_arg)) {
    $new_arg0 .= $new_arg0 == \'\' ? $this_arg : \',\'.$this_arg;
  } else {
    $these_terms = taxonomy_get_term_by_name($this_arg);
    if (count($these_terms)) {
      $new_title .= $new_title == \'\' ? $this_arg : \' - \'.$this_arg;
    }
    foreach ($these_terms as $this_term) {
      $new_arg0 .= $new_arg0 == \'\' ? \'\' : \',\';
      $new_arg0 .= _taxonomy_get_tid_from_term($this_term);
    }
  }
}
if ($new_title) {
  $view->argument[0][\'title\'] = $new_title;
}
return array($new_arg0);';
  $view->page = TRUE;
  $view->page_title = 'Taxonomie test';
  $view->page_header = '';
  $view->page_header_format = '1';
  $view->page_footer = '';
  $view->page_footer_format = '1';
  $view->page_empty = '';
  $view->page_empty_format = '1';
  $view->page_type = 'panels_threecol';
  $view->url = 'taxonomytest';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '10';
  $view->sort = array (
    array (
      'tablename' => 'node',
      'field' => 'sticky',
      'sortorder' => 'DESC',
      'options' => '',
    ),
    array (
      'tablename' => 'node',
      'field' => 'created',
      'sortorder' => 'DESC',
      'options' => 'normal',
    ),
  );
  $view->argument = array (
    array (
      'type' => 'taxid',
      'argdefault' => '2',
      'title' => '%1',
      'options' => '0',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
  );
  $view->field = array (
    array (
      'tablename' => 'term_node',
      'field' => 'name',
      'label' => '',
      'options' => 'link',
    ),
    array (
      'tablename' => 'node',
      'field' => 'title',
      'label' => '',
      'handler' => 'views_handler_field_nodelink',
      'sortable' => '1',
      'defaultsort' => 'ASC',
      'options' => 'link',
    ),
    array (
      'tablename' => 'node',
      'field' => 'body',
      'label' => '',
      'handler' => 'views_handler_field_body',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array (
      'tablename' => 'node',
      'field' => 'distinct',
      'operator' => '=',
      'options' => '',
      'value' => array (
  0 => 'distinct',
),
    ),
    array (
      'tablename' => 'term_data',
      'field' => 'vid',
      'operator' => 'AND',
      'options' => '',
      'value' => array (
  0 => '138',
  1 => '109',
),
    ),
  );
  $view->exposed_filter = array (
  );
  $view->requires = array(node, term_node, term_data);
  $views[$view->name] = $view;

I hope this helps to find the bug!

The same argument handling codes works when I insert in in the popular content view, but not in the taxonomy/term view as seen above.

Greetings,
Martijn
greetings,
Martijn

summit’s picture

Hi,

Can anyone confirm that views with diffiicult argument handling code like above is not working with panels 2?
Thanks in advance!
greetings,

Martijn

merlinofchaos’s picture

Status: Active » Postponed (maintainer needs more info)

I've not seen anything like this; I'm not sure how argument code could affect pane settings saving, they're completely unrelated. You may need to provide the exact steps you go through to reproduce this problem.

summit’s picture

Hi Earl,

first I got this error, only with trying to add the panel on alpha13.

warning: Invalid argument supplied for foreach() in /home/beontop/domains/toekomstgeheugen.nl/public_html/modules/panels/includes/plugins.inc on line 529. 

I will try alpha 14 and give feedback on this.

greetings,
Martijn

summit’s picture

StatusFileSize
new57.07 KB
new14.39 KB

Hi Earl, the invalid argument error is gone with Alpha14! Thats good.
But the view will not save in the panel.

Step1: I added a panel
Step2: I went to site/admin/panels/panel-page/test/edit/content
Step 3: I selected the above view (http://drupal.org/node/192624#comment-631183) to add in the panel-page (see picture select_taxonomy_test.jpg)
Step 4: I tried to save the pane (see picture panel_page).
It will not save.
I tried also without the argument handling code..it will also not save. May be there is something about the view!

Thanks for getting into this. Maybe it is not the argument handling code..
And Earl..I am not in a hurry. You have more important things to do I think.

Anyway when you get time to get into it. Thanks already!

greetings,
Martijn

sun’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Marking as by design for now. Feel free to re-open this issue if you still encounter this error.