Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID


edited April 2013 in Apps

I'm still trying to learn my way around the documentation, so I probably just missed this. However, I didn't see answers to these questions here:

What are the allowed values for icon? picture, ...

Is there a way to specify choices without using a callback function, ie just hard code a list of options?


  • edited February 2013

    Ah yes, the docs need some updating... You can either specify an image, or use any of the icons found here:

    You just leave out the icon- prefix in Elefant :)

  • Thanks. What about hard-coding choices? Is something like this possible?

    param[options] = "value1|value2|value3"

  • I'm afraid not at the moment, no. The easiest way is just to create a class with static methods, like this:

    class MyClass {
        public static function values_for_embed () {
            return array ('yes', 'no', 'maybe');
        public static function values_with_keys () {
            return array (
                array ('key' => 'yes', 'value' => __ ('Yes')),
                array ('key' => 'no', 'value' => __ ('No')),
                array ('key' => 'maybe', 'value' => __ ('Maybe'))

    Save that to your app's lib folder (e..g, apps/demo/lib/MyClass.php), then you can include the values like this:

    ; <?php /*
    label = Hello World
    icon = picture
    param1[type] = select
    param1[label] = Option 1
    param1[callback] = "MyClass::values_for_embed"
    param2[type] = select
    param2[label] = Option 2
    param2[callback] = "MyClass::values_with_keys"
    ; */ ?>
  • edited March 2013

    I was thinking that using values_with_keys would cause the dynamic object to embed the key, but it seems to be embedding the value. For example, I was expecting param2=maybe but it seems to be embedding param2=Maybe.

    Edit: Never mind; I just looked at your example again. I was thinking it was array( 'key' => 'value'), but it's array ( array ( 'key' => 'key1', 'value' => 'value1' ) ). I take it 'key' has to be 'key' and 'value' has to be 'value'?

  • That's right, it needs the sub-array to have the 'key' and 'value'.

Sign In or Register to comment.