You are here

function hook_blockreference_blocks_post_alter in Block reference 7.2

Alter referenceable blocks, AFTER the autocomplete match.

Same exact API as hook_blockreference_blocks_pre_alter().

1 invocation of hook_blockreference_blocks_post_alter()
_blockreference_find_blocks in ./blockreference.module
Helper to find blocks that potentially match a search string, in the right order, altered by custom modules.

File

./blockreference.api.php, line 37

Code

function hook_blockreference_blocks_post_alter(&$blocks, $context) {

  // These are the exact blocks in the result. If the widget is an autocomplete, it will be cut off after 10 (?)
  // elements, so sorting is important. If you change the label here, the displayed labels will be different than
  // the matched labels, so probably don't do that.
  // Reverse sort, because I'm like that.
  uasort($blocks, function ($a, $b) {
    return strnatcasecmp($b->info, $a->info);
  });
}