You are here

function fb_instant_articles_display_sort_fields in Facebook Instant Articles 7.2

Same name and namespace in other branches
  1. 7 modules/fb_instant_articles_display/includes/view_mode_layout.inc \fb_instant_articles_display_sort_fields()

Sorts a multidimensional array by a value in a sub-array.

Parameters

array $a: The array to sort.

string $subkey: The subkey to sort by.

Return value

array The sorted multidimensional array.

1 call to fb_instant_articles_display_sort_fields()
fb_instant_articles_display_field_ui_layouts_save in modules/fb_instant_articles_display/includes/view_mode_layout.inc
Saves layout configuration of Facebook Instant Articles Display View Mode.

File

modules/fb_instant_articles_display/includes/view_mode_layout.inc, line 225
View mode layout functions for Facebook Instant Articles Display.

Code

function fb_instant_articles_display_sort_fields(array $a, $subkey) {
  foreach ($a as $k => $v) {
    if (isset($v[$subkey])) {
      $b[$k] = $v[$subkey];
    }
  }
  asort($b);
  foreach ($b as $key => $val) {
    $c[$key] = $a[$key];
  }
  return $c;
}