Closed (fixed)
Project:
Block reference
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Jun 2011 at 14:55 UTC
Updated:
5 Jul 2011 at 23:02 UTC
Hi,
Just wanted to say maybe adding a sorting by ALpha through the block would be a nice addon.
I've added the following like to the code to make it work.
OLD:
/**
* Implementation of hook_allowed_values().
*/
function blockreference_allowed_values($field) {
$options = _blockreference_potential_references($field, TRUE);
foreach ($options as $key => $value) {
$options[$key] = _blockreference_item($field, $value);
}
if (!$field['required']) {
$options = array(0 => '<'. t('none') .'>') + $options;
}
return $options;
}
NEW:
OLD:
/**
* Implementation of hook_allowed_values().
*/
function blockreference_allowed_values($field) {
$options = _blockreference_potential_references($field, TRUE);
foreach ($options as $key => $value) {
$options[$key] = _blockreference_item($field, $value);
}
+ array_multisort(array_map('strtolower', $options), $options);
if (!$field['required']) {
$options = array(0 => '<'. t('none') .'>') + $options;
}
return $options;
}
Comments
Comment #1
danielb commenteddone, thanks