Intranet site has multiple webform-enabled content types. When adding a "Webform has name" condition to a rule only nodes of the "webform" content type are listed.
function webform_rules_get_webforms() {
$result = db_query("SELECT nid, title FROM {node} WHERE type = :type", array(
':type' => 'webform',
));
Shouldn't the query in function webform_rules_get_webforms search for all webform-enabled content types?
I have not done much Drupal coding, so I hesitate to submit a patch, but the following db_select code (lifted from "webform_mollom_form_list") which uses the stored variable 'webform_node_types' is working for me.
function webform_rules_get_webforms() {
$webform_types = webform_variable_get('webform_node_types');
$result = db_select('node', 'n')
->fields('n', array('nid', 'title'))
->condition('n.type', $webform_types, 'IN')
->execute();
$options = array();
foreach ($result as $record) {
$options["webform-client-form-{$record->nid}"] = $record->title;
}
return $options;
}
Comments
Comment #1
stborchertThanks for the hint.
Slightly modified and committed to 6.x-1.x and 7.x-1.x.
Comment #2
borngunners commentedI have an issue with my webform after upgrading to the latest version 6.x. Before upgrading there was no issue with the get function now I am missing the name of the departments. Instead of showing the name of the department, it shows the key value. A developer did the webform and I have no idea what he did and what needed to be changed to correct the issue. Below is the code and I have attached a sample image of the issue that I am having:
Comment #3
stborchert@borngunners: please ask in the Webform issue queue (http://drupal.org/project/issues/webform). This has nothing to do with a) this issue here and b) Webform Rules in general.