Reading the webform module code I could not figure out how webform content type is defined. I only found this piece of code:

function webform_node_type($op, $info) {
  $webform_types = webform_variable_get('webform_node_types');
  $affected_type = isset($info->old_type) ? $info->old_type : $info->type;
  $key = array_search($affected_type, $webform_types);
  if ($key !== FALSE) {
    if ($op == 'update') {
      $webform_types[$key] = $info->type;
    if ($op == 'delete') {
    variable_set('webform_node_types', $webform_types);

In variable table of drupal database I found the following webform_node_types variable: a:1:{i:0;s:7:"webform";}. When applying variable_get to this variable I recieve an array of 1 element with value - 'webform'. Please help me understand how webform node type actually is defined and how it works? Thanks


The initial webform content type is created during install as an entity of type node. The code can be found in the webform_install() function:

$webform_type = array(
  'type' => 'webform',
  'name' => st('Webform'),
  'base' => 'node_content',
  'description' => st('Create a new form or questionnaire accessible to users. Submission results and statistics are recorded and accessible to privileged users.'),
  'custom' => TRUE,
  'modified' => TRUE,
  'locked' => FALSE,
$webform_type = node_type_set_defaults($webform_type);
if (variable_get('webform_install_add_body_field', FALSE)) {

Additionally it might be worth noting, that you can turn any content type into a webform by checking the appropriate setting on the content types main configuration page. You can think of webform as an add-on extension to other content types. To find out which content types are "webform enabled" you should use the provided API functions. In webform-7.x-4.0-beta for example that would be webform_node_types().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.