1

Is there a way to change edit link for Nodes?

Currently Edit looks like this: [node/node_id/edit]

I required to look like this: [node/edit/node_id]

3
  • Yes you can change it, But why you want to change that one? Commented Mar 25, 2013 at 6:29
  • It is an requirement from Denmark client, who is doing part development Commented Mar 25, 2013 at 6:31
  • 1
    Very odd requirement... Commented Mar 25, 2013 at 13:46

1 Answer 1

2

Try out this code. add it to your module

function mymodule_url_outbound_alter(&$path, &$options, $original_path) {
  if (preg_match('|^node/([0-9]*)/edit(/.*)?|', $path, $matches)) {
    if ($node->nid == $matches[1]) {
      $path = 'node/edit/$node->nid' . $matches[2];
    }
  }
}
5
  • Awesome answer. It would be great If you add more information on how your code works actually. Commented Mar 25, 2013 at 6:54
  • is it works for you?
    – monymirza
    Commented Mar 25, 2013 at 6:55
  • I'm aware of the hook_url_outbound_alter(), but haven't tried this one. Hope it works for you :) Commented Mar 25, 2013 at 6:59
  • url is swapped, but it doesnt redirect to page and drupal throws page not found error. Commented Mar 25, 2013 at 9:36
  • what result u got here? url??
    – monymirza
    Commented Mar 25, 2013 at 10:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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