Is there a way to reverse order of the outputed list:

enter image description here

These items were being added as Global:Contextual links in the View, but order is wrong. Instead of going and replacing in each view (lets say that there are 100 views), what would be the quickest way of reversing order and making it like :

  • Manage display
  • Clone
  • Access Control
  • Delete
  • Edit


  • ....what's CCL? – No Sssweat Feb 19 '16 at 20:29
  • ooops no ccl. my bad. – Michael Feb 19 '16 at 20:36

You have to implement the hook_menu_alter and adjust the links weight property to your will. Here is a sample code that changes the node's default contextual links by placing the delete link over the edit link:

 * Implements hook_menu_alter().
function foo_menu_alter(&$items) {
  $items['node/%node/delete']['weight'] = 0;
  $items['node/%node/edit']['weight'] = 1;

Keep in mind that the smallest the weight of a link the more will flow on top, negative numbers may also be used.

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.