Creating a registry of all form IDs on a site is, in general, impossible because you can create dynamic form IDs by using hook_forms
. If you want to add an identical button to, say, every image in a gallery you might actually want to do that.
function example_forms($form_id, $args) {
$forms = array();
if (!empty($args) && is_object($args[0]) && isset($args[0]->nid) && $form_id == 'example_myform_' . $args[0]->nid) {
$forms[$form_id]['callback'] = 'example_myform';
}
return $forms;
}
now you can call drupal_get_form('example_myform_' . $node->nid, $node)
without a problem for any node and have as many form IDs as nodes. I find this easier than putting the gallery inside a form (say, it's generated by Views...) and generating a different-named button with a button-level #submit
handler.
Anyways, I am sure there are other problems making it necessary to have an arbitrary number of form IDs.