I was wondering if there is a way to only allow members of a role to edit the fields or components of the form and have the other form settings disabled... as the other settings could have default values or the form could be built programatically. And could you set things like the max number of fields for that role?

Comments

quicksketch’s picture

Category: feature » support

Yes, you could do all of those things, but we probably won't be adding such options to the main module's UI. To restrict access to certain settings, all it would take is a hook_form_alter() (or maybe hook_menu_alter() too) and denying access on certain forms and elements. Without a UI to change settings, those settings are effectively locked.

Webform already provides a flexible system for providing access control to entire nodes' results and form configuration (making things like https://drupal.org/project/og_webform possible). However all that control is at the menu-level, basically allowing access to certain pages or not. However if that's what you're looking for, you might look at that module for examples, or read through the various access hooks documented in webform.api.php.

But for the majority of your request, I feel like it's going to come down to custom code and some hook_form_alter()'ing. As such, this question is generally out of scope for the Webform issue queue, as we don't provide support on custom development.

rulley’s picture

thank you those ideas are working... one other question on the creating the web form programmatically - how do you attach it to a node content type?

quicksketch’s picture

For the most part, Webforms are attached to nodes simply by populating the $node->webform array and then calling node_save(). If you need an additional node type to be Webform-enabled besides just the "webform" node type, you may do that from the Webform settings page. Right now that saves into the "webform_node_types" variable, but that may change in #2062235: Split webform_node_types as content type specific..

quicksketch’s picture

Issue summary: View changes
Status: Active » Closed (fixed)