Hello,

is set up a view with views cloud as style and it works fine.

I want to make the title field as link and that doesn't work properly.

I have one field, wich gives me the nid and is excluded from output.

If I use [title] as replacement pattern it works, if I use [nid] as replacement pattern it doesn't. I get the same nid for every link. In my case 6

Please have a look at my screenshot.

Any suggestion, how to solve my Problem?

CommentFileSizeAuthor
#2 duplicated-nid-893054-2.patch651 bytesdan.nsk
screenshot.png214.97 KBshopdogg

Comments

shopdogg’s picture

Used a views custom field to solve the problem.

dan.nsk’s picture

Status: Needs work » Active
StatusFileSize
new651 bytes

I am also experiencing this bug. When I am trying to "output а field as a link" or "rewrite the output of а field" and use the [nid] as a pattern, each cloud’s element being given the same substituted value for nid.

I am not an expert in the views module’s internals, but after investigating the template_preprocess_views_cloud_style() in views_cloud.module and comparing its logic to the template_preprocess_views_view_table() function (in views/theme/theme.inc) I realized that the first one was probably the source of the problem.

Specifically, I noticed the following fragment in template_preprocess_views_view_table():

  // Fields must be rendered in order as of Views 2.3, so we will pre-render
  // everything.
  $renders = $handler->render_fields($result);

In template_preprocess_views_cloud_style() each field gets themed separately:

  foreach ($fields as $field => $column) {
    foreach ($result as $num => $row) {
      if ((!$hide || ($field != $weight_field)) &&
          !empty($fields[$field]) && empty($fields[$field]->options['exclude'])) {
        $field_output = $fields[$field]->theme($row);
        $vars['rows'][$num]['output'] .= $field_output;
      }
    }

So I decided to rewrite this block using the template_preprocess_views_view_table()’s logic. After that my view began to work properly.

I am attaching the patch for the views_cloud.module. I don’t think it should be used in production environment as I don’t fully understand this function’s logic. The patch should rather be reviewed by the module’s maintainer.

dan.nsk’s picture

Component: Miscellaneous » Code
Category: support » bug
Status: Active » Needs work

Setting the proper status

vacilando’s picture

Status: Active » Needs work

Ran into the same bug...

wapnik’s picture

Status: Needs work » Reviewed & tested by the community

The patch looks good...

soulfroys’s picture

The patch works! Tks!

kenorb’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Closed (outdated)

Closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.