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

Use callback to generate custom field values?

edited June 2014 in Framework

Lines 55 - 69 of admin/handlers/util/extended.php look like this:

    if ($field->type === 'select') {
        $data['fields'][$k]->options = preg_split ("/[\r\n]+/", $field->options);
    } elseif ($field->type === 'file' || $field->type === 'image') {
        $load_assets = true;
    } elseif (strpos ($field->type, '_') !== false) {
        list ($app, $extra) = explode ('_', $field->type);
        $fields = parse_ini_file ('apps/'. $app . '/conf/fields.php', true);
        if (isset ($fields[$field->type])) {
            $settings = $fields[$field->type];
            if ($settings['type'] === 'select') {
                $data['fields'][$k]->type = 'select';
                $data['fields'][$k]->options = call_user_func ($settings['callback']);
            }
        }
    }

It looks like it's possible to pass a type of myapp_select and then create an .ini file in apps/myapp/conf/fields.php with, I'm guessing, something like

[field_name]
require = "apps/myapp/lib/Functions.php"
callback = "fieldname_get_values"

Is that the case and, if so, how do I set the type to myapp_select?

Comments

Sign In or Register to comment.