You are here

function nodeformsettings_enable in Node and Comments Form Settings 7.3

Same name and namespace in other branches
  1. 7.2 nodeformsettings.module \nodeformsettings_enable()

Implements hook_enable().

File

./nodeformsettings.module, line 6

Code

function nodeformsettings_enable() {

  // If the variable is not initialized then errors shows up,
  // I don't like this since it seems is like playing with fire but
  // basically, for every content type, if the variable nodeformsettings_$type
  // does not exists, then create it with an empty array
  // This should respect any content type where the variable has been set by the
  // user with custom values.
  $types = node_type_get_types();
  foreach ($types as $type => $content_type) {
    $variable = variable_get("nodeformsettings_" . $type);
    if (!isset($variable)) {
      variable_set("nodeformsettings_" . $type, array());
    }
  }
}