I have created one content type named "collection", where I will be grouping the related articles into collection. The content type itself has other fields like title, tags etc.

To add article into collection, I have created field of type referenced entity and is working fine. Also use can add multiple articles into collection.

Now I wanted to provide the user to manage order of the articles in the collection, so that article can be arranged in proper order.

So at the time of selecting article, user also decides its order/weight.

Is there any drupal module that helps in achieving this or how can I achieve it if no module is there.

-- Thanks for your time

  • 5
    That function should already exist in Entity Reference which I assume you are refering to. What widget did you set the field to? Try with the autocomplete one.
    – hampusn
    Jan 21, 2013 at 14:47

4 Answers 4


If you are using Entity reference has the option to sort. I will give you three choices.

1. Manually:

Go to the /node/nodenumber/edit and you can specify the order that you want Entity Reference Manually seems to be your best choice because it is your user who decides the order

2. Programatically

If want to order by descending (Ascending is the default). The only it worked for me was to use array_reverse:

$value -> field_reference_field_to_reference['und']=array_reverse($value -> field_reference_field_to_reference['und']);
$value -> field_reference_field_to_reference['und'][]['target_id'] = $node -> nid;
$value -> field_reference_field_to_reference['und']=array_reverse($value -> field_reference_field_to_reference['und']);

3. Fields settigs in the entity reference

There is another option of sorting in your content type field settings:


and then you can tell it to sort by

However, to be honest the last method number 3 has not worked for me for some reason. If you made it work. Please let me know your solution. I would love to know what am I doing wrong. :)

  • 1
    Thanks...it worked, I was using select type widget so there was no option for it. Jan 22, 2013 at 4:58
  • 1
    The third option is probably not working because "Sort by" does not refer to the way that the fields are printed. If you notice, it's in the "Entity Selection" fieldset. This means that it controls the way that the options in the dropdown list are sorted (i.e. the entities that you are about to select). It DOES NOT control how the output is rendered (and by the way that's why the specific option does not disappear even if you have a single-value entityreference field). Method #3 should be removed since it may confuse people.
    – F1234k
    Jul 31, 2014 at 17:29
  • Thank you for the detail explanation. :) I appreciate it. I will leave it there in case someone does not get what is happening, too.
    – cayerdis
    Jul 31, 2014 at 17:34

To add detail to Solution #1, above, for folks coming afterwards looking for the same answer:

When creating the Entity Reference field on the main content type (whichever Content Type will display the referenced entity) under "Widget" select "autocomplete", as mentioned. Under "Number of Values", select "unlimited" (or more than one). Save that Content Type.

Then, when you create or edit the node that is made from that Content Type, you will see the Entity Reference autocomplete option towards the bottom of the content entry form. To the upper right of that part of the form, you will see "Hide Row Weights" or "Show Row Weights" as a small text link. Once you show the row weights you can give your results a sort order.

Small aside: Once you have enabled "Show Row Weights", this choice will persist in your control panel. So if you want to be able to sort menu items (for example) by dragging, you'll have to toggle this link back to "Hide Row Weights".


There is an option to do what Cayerdis recommends in option 1 without using the Autocomplete option. The multiple selects widget is "a fairly simple rework that turns a single multiple value select list into a series of single value select lists, with an 'Add more' button. It's very easy to set up, just enable the module and choose the 'Multiple Selects List' widget as the widget." (-- from lullabot article).


See this article for several options to extend the functionality -> http://www.lullabot.com/blog/article/entityreference-multiselectors

  • Welcome to Drupal Stack Exchange! Please consider expanding your answer to include at least the concepts from the lullabot article.
    – digital
    Jan 6, 2014 at 21:27
  • the multiple selects plugin is absolutely amazing! Jul 1, 2014 at 9:32
  • Thanks digital. I updated the description based on your comment. Jul 2, 2014 at 14:13

Please see if this solution would work for you.

Create a group field one with the entity and the other with an order field of the type text where the user can enter a number to represent the order. then you can use this field to order the article.

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.