In SmartSection, one of the option of my SpotLight
Block needs to be an array. Unless I'm mystaken, this
is not possible for now.
If we edit the file
modules/system/admin/blocksadmin/blockadmin.php, and
add this after line 265 :
[quote]// Hack by marcan to enabled array type options
for ( $i = 0; $i < count($options); $i++ ) {
if (is_array($options[$i])) {
$options[$i] = implode(',', $options[$i]);
}
}[/quote]
This will save an option that is an array in this string :
[code]item1, item2, item3[/code]
I think this sould be included in the core. Then, when
the module developper needs to access a block option of
an aray type, he could use something like this :
[code] if ((!empty($options[2])) &&
is_array($options[2])) {
$sel_items = explode(',', $options[2]);
}[/code]
I'm not 100% sure of the code, but it works for me. Let
me know if it' ok !
Thanks !
Logged In: YES
user_id=841117
Added in 2.0.9 branch - This is an important one to
communicate on release as certain modules already use one
array value, but with a somewhat "bastard" implementation,
taking all $options[i] where i > a certain value to belong
to this array type input box.
Difficult to explain, but I'll have a better wording for the
release.
Logged In: YES
user_id=880332
Perfect !
And for in my information, the code to get the array option
in the module, is it good ? Is it optimal ?
Thanks !