You are here

function simplify_global_configuration_form in Simplify 7.3

Simplify global configuration form.

1 string reference to 'simplify_global_configuration_form'
simplify_menu in ./simplify.module
Implements hook_menu().

File

./simplify.module, line 85
Simplifies the user interface by hiding particular fields.

Code

function simplify_global_configuration_form($form, &$form_state) {

  // User 1 permission
  $form['simplify_user1'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide fields from User 1'),
    '#description' => t("By default, Drupal gives User 1 <em>all</em> permissions (including Simplify's <em>View hidden fields</em> permission). This means that User 1 will always be able to view all hidden fields (and is by design).<br>Check this box to override this functionality and hide fields from User 1. NOTE: As this option overrides default Drupal behaviour, it should be used sparingly and only when you fully understand the consequences."),
    '#default_value' => variable_get('simplify_user1', 0),
  );

  // Nodes
  $form['nodes'] = array(
    '#type' => 'fieldset',
    '#title' => t('Nodes'),
    '#description' => t("These fields will be hidden from <em>all</em> node forms. Alternatively, to hide fields from node forms of a particular content type, edit the content type and configure the hidden fields there."),
  );
  $form['nodes']['simplify_nodes_global'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Hide'),
    '#options' => simplify_get_fields('nodes'),
    '#default_value' => variable_get('simplify_nodes_global', array()),
  );

  // Users
  $form['users'] = array(
    '#type' => 'fieldset',
    '#title' => t('Users'),
    '#description' => t("These fields will be hidden from all user account forms."),
  );
  $form['users']['simplify_users_global'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Hide'),
    '#options' => simplify_get_fields('users'),
    '#default_value' => variable_get('simplify_users_global', array()),
  );

  // Comments
  if (module_exists('comment')) {
    $form['comments'] = array(
      '#type' => 'fieldset',
      '#title' => t('Comments'),
      '#description' => t("These fields will be hidden from <em>all</em> comment forms. Alternatively, to hide fields from comment forms for nodes of a particular content type, edit the content type and configure the hidden fields there."),
    );
    $form['comments']['simplify_comments_global'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Hide'),
      '#options' => simplify_get_fields('comments'),
      '#default_value' => variable_get('simplify_comments_global', array()),
    );
  }

  // Taxonomy
  if (module_exists('taxonomy')) {
    $form['taxonomy'] = array(
      '#type' => 'fieldset',
      '#title' => t('Taxonomy'),
      '#description' => t("These fields will be hidden from <em>all</em> taxonomy term forms. Alternatively, to hide fields from taxonomy term forms for a particular vocabulary, edit the vocabulary and configure the hidden fields there."),
    );
    $form['taxonomy']['simplify_taxonomy_global'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Hide'),
      '#options' => simplify_get_fields('taxonomy'),
      '#default_value' => variable_get('simplify_taxonomy_global', array()),
    );
  }

  // Blocks
  if (module_exists('block')) {
    $form['blocks'] = array(
      '#type' => 'fieldset',
      '#title' => t('Blocks'),
      '#description' => t("These fields will be hidden from all block forms."),
    );
    $form['blocks']['simplify_blocks_global'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Hide'),
      '#options' => simplify_get_fields('blocks'),
      '#default_value' => variable_get('simplify_blocks_global', array()),
    );
  }

  // Profiles
  if (module_exists('profile2_page')) {
    $form['profiles'] = array(
      '#type' => 'fieldset',
      '#title' => t('Profiles'),
      '#description' => t("These fields will be hidden from all profile forms."),
    );
    $form['profiles']['simplify_profiles_global'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Hide'),
      '#options' => simplify_get_fields('profiles'),
      '#default_value' => variable_get('simplify_profiles_global', array()),
    );
  }

  // Remove empty values from saved variables (see: http://drupal.org/node/61760#comment-402631)
  $form['array_filter'] = array(
    '#type' => 'hidden',
  );
  return system_settings_form($form);
}