2

I would like to edit the functionality contained in nodereference_autocomplete() so that it will only return a subset of all nodes. What would be the best way to override this default functionality?

  • Since we're having a huge discussion below about what you're intentions are, please clarify what you are trying to do. – Berdir May 4 '11 at 14:57
2

This isn't exactly the same question, but I think this answer is just as valid.

If I understand you right, you can use a View as the source for the nodereference widget, and give it appropriate filters to only show nodes of a certain type authored by the current user. Or have I got the wrong end of the stick?!

0

An autocomplete function is, in Drupal 6, registered as menu callback. For example, this is the code used by user.module to register the function that autocompletes the usernames.

function user_menu() {
  $items['user/autocomplete'] = array(
    'title' => 'User autocomplete', 
    'page callback' => 'user_autocomplete', 
    'access callback' => 'user_access', 
    'access arguments' => array('access user profiles'), 
    'type' => MENU_CALLBACK, 
    'file' => 'user.pages.inc',
  );

  // …
}

If you want to alter the autocomplete function defined from a module, you just implement hook_menu_alter() to alter the menu callback definition that uses the autocomplete function as menu callback.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.