miniol of Omeka
1/3/2017 - 8:15 AM

Filter the collections browse SQL to sort records alphabetically by name.

Filter the collections browse SQL to sort records alphabetically by name.

<?php

/**
 * Filter the collections browse SQL to sort records alphabetically by name.
 */
function filter_collections_alphabetically($select, $params)
{
  if (!array_key_exists('sort_field', $params)) {
    $select->order('c.name ASC');
  }
  return $select;
}

add_plugin_hook('collection_browse_sql', 'filter_collections_alphabetically');