Closed (fixed)
Project:
Custom filter
Version:
5.x-1.2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
18 May 2008 at 10:05 UTC
Updated:
15 Jul 2009 at 15:49 UTC
$node->nid doesn't appear to be available in the php-code section of the filter. What do you suppose is the best way of getting the nid for the current node? (Might want to reassign this as a feature request)
Awesome module by the way, a real gem.
Comments
Comment #1
arhip commentedHi,
Filters are processed before node object loaded, that's why we couldn't merely use $node object. See issue #229936: Date issue in php-enabled custom filter for details. There a patch in comment #2, or you can copy and paste this code to your customfilter.module
In the filter's code, use
$vars->node->nidto get the node's nid, or$vars->nodeto get node object. This patch forces drupal to load node before the filter get processed.Hope it helps.
Thanks for your kind words.
Comment #2
avpadernoI am setting this support request as fixed because it got an answer. The reported code is the one used in the 6.x-2 branch.
Comment #4
avpaderno