Display order of entity reference fields I have an entity reference field which references and displays multiple nodes on a Drupal 7 install.
I am trying to get them to display in date order (the date is a field on the referenced nodes).  The problem I have is that if a referenced node date is changed, or a new one created, the display order doesn't change.

I use a entity reference view to order the nodes on their date fields, which works when you manually edit the master node and then save it.  This then updates the order.  However this not a very practical solution.

I have tried creating a module which when referenced nodes are modified or created, it programatically loads and saves the master node using node_load and node_save.

However this doesn't trigger the referenced nodes to update their display order.

Does anyone know anything else I can try?
In case someone stuck on this, i have a solution for Drupal 8 (you can figure it out for 7):
In themename.theme add a preprocess funtion:  

function themename_preprocess_field__field_entity_reference(&amp;$variables) {
    usort($variables['items'], function ($a, $b) {
        $a = isset($a['content']['#node']) ? $a['content']['#node']-&gt;field_display_order-&gt;value : null;
        $b = isset($b['content']['#node']) ? $b['content']['#node']-&gt;field_display_order-&gt;value : null;

        // Do the comparison
        // This &lt;=&gt; operator only work for PHP &gt;= 7
        return $a &lt;=&gt; $b;
    });
}