You are here

function views_natural_sort_transform in Views Natural Sort 7.2

Encodes a string into an ascii-sortable string.

Encoding rquires a set of transformations. Those transformations perform functionality such as:

  • Leading articles in common languages are ingored: The A An El La Le Il
  • Unimportant punctuation is ignored: # ' " ( )
  • Unimportant words are ignored: and of or.

Parameters

array $index_entry: Mirrors the views_natural_sort table $eid - Entity Id of the item referenced $entity_type - The Entity Type. Ex. node $field - reference to the property or field name $delta - the item number in that field or property.

Return value

string The transformed string

1 call to views_natural_sort_transform()
views_natural_sort_store in ./views_natural_sort.module
Save an entry to the database that represents a views_natural_sort index.

File

./views_natural_sort.module, line 295
Views Natural Sort module.

Code

function views_natural_sort_transform(array $index_entry) {

  // Get copy the original string.
  $string = $index_entry['content'];
  module_load_include('inc', 'views_natural_sort', 'views_natural_sort');
  foreach (views_natural_sort_get_transformations($index_entry) as $transformation_method) {
    $string = $transformation_method($string);
  }
  return $string;
}