You are here

function csm_variables in Custom Submit Messages 7

Same name and namespace in other branches
  1. 6 csm.module \csm_variables()

Returns a list of all of the variables the module may have added to the variable table. Used in csm.install when uninstalling the module to clear the variables out of the variable table.

1 call to csm_variables()
csm_uninstall in ./csm.install
Implements hook_uninstall().

File

./csm.module, line 729
The main module file for Custom Submit Messages.

Code

function csm_variables() {
  $crud = array(
    'insert_msg',
    'delete_msg',
    'form_title',
    'update_msg',
  );
  $node_types = node_type_get_types();
  $user_roles = user_roles();
  $user_roles['global'] = 'global';
  if (module_exists('locale')) {
    $languages = locale_language_list();
  }
  else {
    $languages = array(
      'en' => 'en',
    );
  }
  foreach ($crud as $crud_key => $crud_value) {
    foreach ($node_types as $node_type_key => $node_type_value) {
      foreach ($languages as $language_key => $language_value) {
        foreach ($user_roles as $rid => $role) {
          $variables[] = 'csm_' . $crud_value . '_' . $language_key . '_' . $rid . '_' . $node_type_key;
        }
      }
    }
  }
  if ($csm_node_temp = variable_get('csm_node_temp', FALSE)) {
    $variables[] = 'csm_node_temp';
  }
  if ($csm_settings = variable_get('csm_attributes', FALSE)) {
    $variables[] = 'csm_attributes';
  }
  $sql = 'SELECT name FROM {variable} WHERE name LIKE :name';
  $args = array(
    ':name' => db_like('csm_node_temp_') . '%',
  );
  foreach (db_query($sql, $args) as $result) {
    $variables[] = $result->name;
  }
  return $variables;
}