Reviewing the latest version of code in realname.module. I am trying to figure out how to integrate it with og admin pages/views
The hook_menu () $item for the autocomplete callback is
$items['realname/autocomplete'] = array(
'page callback' => 'realname_autocomplete',
'page arguments' => array('', '', 2),
'access arguments' => array('access user profiles'),
'type' => MENU_CALLBACK,
and the hook_menu_alter () $item to override user/autocomplete is a consistent
$items['user/autocomplete']['page callback'] = 'realname_autocomplete';
$items['user/autocomplete']['page arguments'] = array('', '', 2);
however the function call is
function realname_autocomplete($field_name, $entity_type, $bundle_name, $string = '')
So for me the $string variable should never get set as the function is only called with 3 parameters. In DEBUG mode I can see it actually gets set to the same value as you enter in the autocomplete field but so does the $bundle field (which you would expect). So the function works - but I don't know why. Perhaps I am missing something here, I am not that experienced.
I think the 'page arguments' => array('', '', 2) and $items['user/autocomplete']['page arguments'] = array('', '', 2) values need to actually set to be array('', '', ", 2). I tried this and the $bundle was then set to "" and $string to the entered value and it all seemed to work
I am ignoring the entityreference autocomplete fields for this issue, although that looks short as well.
Comments
Comment #1
simon_j_nichols CreditAttribution: simon_j_nichols commentedComment #2
hass CreditAttribution: hass commentedComment #3
hass CreditAttribution: hass commented