#57 Enable array type options in blocks


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]);
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]);

I'm not 100% sure of the code, but it works for me. Let
me know if it' ok !

Thanks !


  • Jan Pedersen

    Jan Pedersen - 2004-10-03

    Logged In: YES

    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

  • Marc-Andre Lanciault

    Logged In: YES

    Perfect !

    And for in my information, the code to get the array option
    in the module, is it good ? Is it optimal ?

    Thanks !


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks