Hi, this may fall under a feature request, but it seems so standard to CCK/Drupal. That is the option to create the allowed values for a select list with PHP. The option is missing with this widget. Could it be added? In my case I have a select list that gives two different groups, different options (values) to choose from. In my 'Allowed values' area, I choose PHP and have this code to do that:

global $user;
$group = $user->roles[3]; 

$colorList[0] = "red";
$colorList[1] = "green";
$colorList[2] = "blue";
$colorList[3] = "black";
$colorList[4] = "white";

$names[0] = "Joe";
$names[1] = "Bob";
$names[2] = "Sue";
$names[3] = "John";
$names[4] = "Amy";

if ($group == "bhrp") {
 return $colorList;
 } else {
  return $names;
}

Maybe this could be 'borrowed' easily from other CCK widgets?

Very useful little UI module, thanks!

CommentFileSizeAuthor
#2 explainfield.allow_php.patch2.84 KBbrad.bulger

Comments

snufkin’s picture

Category: support » feature

i am not sure how soon i can implement this, but its a reasonable request, i will do it when i have some time.

brad.bulger’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev
StatusFileSize
new2.84 KB

i added this in to the 6.x version, because i needed to use ampersands in key values. seems to work so far.