You are here

function submitted_by_update_7001 in Submitted By 7

Set up submitted varaiables.

File

./submitted_by.install, line 42
Install, update and uninstall functions for the Submitted By module.

Code

function submitted_by_update_7001() {

  // Get all node type.
  $node_types = node_type_get_types();

  // Get info about view_modes.
  $entity_info = entity_get_info('node');
  foreach ($entity_info['view modes'] as $mode => $info) {
    $strings[$mode] = SUBMITTED_BY_NODE_TEXT;
  }

  // Save the node type and comment settings.
  foreach ($node_types as $node_type) {

    // If varaiable are not set, then only save the variable.
    if (variable_get('submitted_by_' . $node_type->type, array()) == array()) {
      variable_set('submitted_by_' . $node_type->type, $strings);
    }
    if (variable_get('submitted_by_comment_node_' . $node_type->type, NULL) == NULL) {
      variable_set('submitted_by_comment_node_' . $node_type->type, SUBMITTED_BY_COMMENT_NODE_TEXT);
    }
  }
}