Converting array to Drupal format
Posted
by theo
on Stack Overflow
See other posts from Stack Overflow
or by theo
Published on 2010-03-30T15:08:24Z
Indexed on
2010/03/30
15:13 UTC
Read the original article
Hit count: 503
Hi all,
This statement gives me the value I want in Drupal (namely the last user role):
global $user; return (end($user->roles));
however I need to convert it to this format:
return array(
0 => array('value' => value for value),
// You'll usually want to stop here. Provide more values
// if you want your 'default value' to be multi-valued:
1 => array('value' => value for value),
2 => ...
);
and I've got no idea how to (also, is this format a multidimensional array?)...
Any ideas? Thanks for any help, Theo.
© Stack Overflow or respective owner