You are here

function commentformsettings_enable in Node and Comments Form Settings 7.3

Same name and namespace in other branches
  1. 7.2 commentformsettings/commentformsettings.module \commentformsettings_enable()

Implements hook_enable().

File

commentformsettings/commentformsettings.module, line 10

Code

function commentformsettings_enable() {

  // If the variable is not initializated 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("commentformsettings_" . $type);
    if (!isset($variable)) {
      variable_set("commentformsettings_" . $type, array());
    }
  }
}