By nancydru on
In D5 I had the following in my hook_menu:
$result = db_query('SELECT format, name FROM {filter_formats}');
while ($filter = db_fetch_array($result)) {
$enabled = db_result(db_query("SELECT COUNT(delta) FROM {filters} WHERE format=%d AND module='glossary'", $filter['format']));
if ($enabled || !variable_get('glossary_hide_menus', false)) {
$items[] = array(
'path' => 'admin/settings/glossary/filter/'. $filter['format'],
'title' => $filter['name'],
'access' => user_access('administer filters'),
'callback' => 'drupal_get_form',
'callback arguments' => array('glossary_filter_form', $filter['format']),
'description' => t('Settings for the !name input format.', array('!name' => $filter['name'])),
'weight' => 2,
'type' => MENU_LOCAL_TASK,
);
}
}
and the form had:
function glossary_filter_form($format = 1) {
In D6, I now have:
$result = db_query('SELECT format, name FROM {filter_formats}');
while ($filter = db_fetch_array($result)) {
$enabled = db_result(db_query("SELECT COUNT(delta) FROM {filters} WHERE format=%d AND module='glossary'", $filter['format']));
if ($enabled || !variable_get('glossary_hide_menus', false)) {
$format = $filter['format'];
$items['admin/settings/glossary/filter/'. $format] = array(
'title' => $filter['name'],
'access arguments' => array('administer filters'),
'page callback' => 'drupal_get_form',
'page arguments' => array('glossary_filter_form', $format),
'description' => 'Settings for the !name input format.', array('!name' => $filter['name']),
'weight' => 2,
'type' => MENU_LOCAL_TASK,
);
}
}
But the function is getting an array passed to it rather than the scalar format number. All I want is that silly number, which does not even seem to be in that array.
I've tried making the format number a wildcard but that eliminates all my tabs.
Comments
Also
I've also tried:
'page arguments' => array('glossary_filter_form', 4),and that didn't work either.Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru
This sounds like it could be
This sounds like it could be something to do with the form function. Drupal 6 changed a few things with Form API. One is drupal_get_form passes a $form_state parameter now. I don't know if you have already made necessary changes, but form functions used by drupal_get_form will have a new first parameter.
See http://drupal.org/node/144132#multistep
-Craig Jackson
-Web Developer
Thanks
That's one I missed. Thanks, that was it.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru