1

I need to have the "edit node" link as a field so that I can manage its display.

Can I do this?

Update: I created the field but the token code is printed instead of its value. The code you see in the capture is printed: http://misite.com/node/%5Bnode%3Anid%5D/edit

Capture:

enter image description here

2

As variant, You can create custom code field via display suite module.

Example field code for node edit link:

 

print l(t('Edit this node'), 'node/' . arg(1) . '/edit'); 

  • I created the field but the token code is printed instead of its value. The code you see in the capture (at the bottom of my question) is printed: http://misite.com/node/%5Bnode%3Anid%5D/edit – chefnelone May 30 '13 at 14:19
  • Oh, tokens are not working with display suite php text format You can use this code: print l(t('Edit this node'), 'node/' . arg(1) . '/edit'); – Alexander Ivanchenko May 30 '13 at 14:31
4

You could also check to see if the user has access before printing the edit link. <?php if (node_access('update', $entity)) { print l(t('Edit'), 'node/' . $entity->nid . '/edit'); } ?>

1

I think you better use $entity->nid when you want to print the nid in display suite format. With $entity->nid the correct nid of each item is printed when used in teaserlists.

<?php print l(t('Edit this node'), 'node/' . $entity->nid . '/edit'); ?>

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.