You are here

function om_tools_admin in OM Tools 6.2

Same name and namespace in other branches
  1. 8.2 inc/om_tools.admin.inc \om_tools_admin()
  2. 8 om_tools.module \om_tools_admin()
  3. 6 om_tools.module \om_tools_admin()
  4. 7.2 inc/om_tools.admin.inc \om_tools_admin()
  5. 7 om_tools.module \om_tools_admin()

Admin Form - Simple Editing

1 string reference to 'om_tools_admin'
om_tools_menu in ./om_tools.module
Implementation of hook_menu().

File

inc/om_tools.admin.inc, line 16
OM Tools Admin Configuration

Code

function om_tools_admin() {
  drupal_set_title(t('OM Tools 2 Settings'));

  // OM Tools container
  $om_tools = variable_get('om_tools', '');
  $tools = om_tools_get();
  $subtools = array();
  $form = array();
  $reset = 0;
  foreach ($tools as $key => $module) {
    om_tools_settings($form, $module);
    if (isset($om_tools[$module])) {
      foreach ($om_tools[$module] as $omkey => $omval) {
        $om_tool_name = array_reverse(explode('_', $omkey));
        if ($om_tool_name[0] == 'reset') {
          $reset += $omval;
          array_shift($om_tool_name);
          $subtools[] = implode('-', array_reverse($om_tool_name));
        }
      }
    }
  }

  // add admin js
  om_tools_admin_js($subtools);

  // button save again will show if the variable is empty
  if ($reset) {
    $form['save again'] = array(
      '#type' => 'submit',
      '#value' => t('Save Settings Again'),
    );
  }

  // button initialize will show if the variable is empty
  if (empty($om_tools)) {
    $form['initialize'] = array(
      '#type' => 'submit',
      '#value' => t('Initialize Settings'),
    );
  }

  // button save will show if the variable is not empty
  if (!empty($om_tools) && !$reset) {
    $form['save'] = array(
      '#type' => 'submit',
      '#value' => t('Save Settings'),
    );
  }
  return $form;
}