I just had a slick idea to make the new #22402: Recent issues block on project nodes more useful. However, I don't know how to best implement it. ;)

Basically, instead of just outputting the title as a link, it'd be slick if it could output [#nid] and let the issue filter do all the fancy stuff it already does (color coding, strike-through, mouse-over, etc). Knowing it wasn't going to work, I tried the new "rewrite the output of this field" stuff, and of course, I just ended up with [#nid] not the desired filter output. ;)

I suppose I could write another custom field handler for issue titles to do this, but that seems a little lame.

Hopefully I can strategize with Earl about this and figure out a reasonable way to solve this...

Comments

merlinofchaos’s picture

I suppose I could implement some kind of a hook to allow you to add filtering to the field output.

sun’s picture

Auto-generating text and invoking the filter system on it doesn't sound like a good idea.

Instead, I'd suggest to make the filter simply expose a public, re-usable function.

The regular, current input is

[#nid]

and the filter process callback is

function project_issue_filter_process($text) { // Sorry, D6 is soo old ;)
  preg_match_all('...', $text, $matches);
  foreach ($matches as $match) {
    $replace[$match[0]] = project_issue_filter_convert($match[1], $match[2]);
  }
  ...
  return $text;
}

so the filter's process helper callback takes

function project_issue_filter_convert($nid, $comment = NULL) {
  $output = ...
  return $output;
}

Hence, you can do a Views field handler that takes the 'nid' (actually, an arbitrary nid), passes it through the helper, and returns the result.