You are here

function message_user_admin_settings in Message 7

Menu callback; Admin settings form.

1 string reference to 'message_user_admin_settings'
message_menu in ./message.module
Implements hook_menu().

File

includes/message.admin.inc, line 43
Message type editing UI.

Code

function message_user_admin_settings($form_state) {
  $form = array();
  $form['purge'] = array(
    '#type' => 'fieldset',
    '#title' => t('Purge settings'),
  );
  $form['purge']['message_purge_enable'] = array(
    '#type' => 'checkbox',
    '#title' => t('Purge messages'),
    '#description' => t('When enabled, old messages will be deleted.'),
    '#default_value' => variable_get('message_purge_enable', FALSE),
  );
  $states = array(
    'visible' => array(
      ':input[name="message_purge_enable"]' => array(
        'checked' => TRUE,
      ),
    ),
  );
  $form['purge']['message_purge_quota'] = array(
    '#type' => 'textfield',
    '#title' => t('Messages quota'),
    '#description' => t('Maximal (approximate) amount of messages.'),
    '#default_value' => variable_get('message_purge_quota', NULL),
    '#element_validate' => array(
      'element_validate_integer_positive',
    ),
    '#states' => $states,
  );
  $form['purge']['message_purge_days'] = array(
    '#type' => 'textfield',
    '#title' => t('Purge messages older than'),
    '#description' => t('Maximal message age in days.'),
    '#default_value' => variable_get('message_purge_days', NULL),
    '#element_validate' => array(
      'element_validate_integer_positive',
    ),
    '#states' => $states,
  );
  $options = array();
  foreach (entity_get_info() as $entity_id => $entity) {
    $options[$entity_id] = $entity['label'];
  }
  $form['message_delete_on_entity_delete'] = array(
    '#title' => t('Auto delete messages referencing the following entities'),
    '#type' => 'select',
    '#multiple' => TRUE,
    '#options' => $options,
    '#default_value' => variable_get('message_delete_on_entity_delete', array(
      'node',
      'user',
      'taxonomy_term',
      'comment',
    )),
    '#description' => t('Messages that reference entities of these types will be deleted when the referenced entity gets deleted.'),
  );

  // Display link to the copy form if the locale module is enabled.
  if (module_exists('locale')) {
    $form['links'] = array(
      '#type' => 'fieldset',
      '#title' => t('Other settings'),
    );
    $form['links']['text_copy'] = array(
      '#markup' => l(t('Copy messages text fields from one language to others'), 'admin/config/system/message/text-copy'),
    );
  }
  $form['message_use_queue'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use queue'),
    '#description' => t('Delete messages without existing reference via queue.'),
    '#default_value' => variable_get('message_use_queue', FALSE),
  );
  return system_settings_form($form);
}