Within the implementation of this hook I return an array of pre-built options lists.
Something like

        $lists[ $data -> id ] = array(
            'title' => $data -> name,
            'options callback' => 'mymodule_options_list',
            'file' => MODULE_NAME . '.functions.inc'
        );

Webform add these items to the pre-built lists set successfully, but does not call any of the callbacks of my custom lists - when I select one of them, it gives me an error saying that Options field is required. Which is fine, if you have chosen nothing in pre-built lists dropdown.
So apparently it doesn't call these callbacks at all.
Function _webform_select_options_callback in components/select.inc, which I supposed is meant to process these callback, is not called too.

Comments

quicksketch’s picture

Status: Needs review » Postponed (maintainer needs more info)

I'll need a more clear example to reproduce. As you've noted, Webform calls these functions successfully for it's own pre-built lists, there shouldn't be any difference for separate modules providing the same thing.

evgeny.chernyavskiy’s picture

/**
 * Implementation of hook_webform_select_options_info().
 */
function casemgr_webform_select_options_info()
{
    $lists = array();
    
    $result = db_query( 'SELECT id, name FROM {casemgr}' );
    while( $data = db_fetch_object( $result ) ) {
        $lists[ $data -> id ] = array(
            'title'                 => $data -> name,
            'options callback' => '_casemgr_webform_options_list',
            'file'                  => 'casemgr.functions.inc'
        );
    }
    
    return $lists;
}

function _casemgr_webform_options_list()
{
    return array( 'test1' => 'test1', 'test2' => 'test2' );
}
quicksketch’s picture

You code works fine for me. I modified it to look like this (since I didn't want to make a database table for it) and put it all in a casemgr.module file.


/**
* Implementation of hook_webform_select_options_info().
*/
function casemgr_webform_select_options_info()
{
    $lists = array();
    $result = array(
      (object) array(
        'id' => 'something',
        'name' => 'sample',
      ),
    );
    foreach($result as $data ) {
        $lists[ $data -> id ] = array(
            'title'                 => $data -> name,
            'options callback' => '_casemgr_webform_options_list',
            'file'                  => 'casemgr.functions.inc'
        );
    }
   
    return $lists;
}

function _casemgr_webform_options_list()
{
    return array( 'test1' => 'test1', 'test2' => 'test2' );
}
evgeny.chernyavskiy’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Okay, for some magic reason (like real magic or my curved hands) it worked this time. Seems like the Webform (which I doubt) or Drupal itself cached the hook implementation and callback(s) implementation(s). Flushing caches from UI and truncating cache tables - at least 3 times each finally helped and Webform recognized all the custom stuff.
Sorry for that.

Closed, I guess.