You are here

function date_repeat_entity_admin_settings in Date Repeat Entity 7.2

Same name and namespace in other branches
  1. 7 date_repeat_entity.module \date_repeat_entity_admin_settings()

Date repeat entity administration.

1 string reference to 'date_repeat_entity_admin_settings'
date_repeat_entity_menu in ./date_repeat_entity.module
Implements hook_menu().

File

./date_repeat_entity.admin.inc, line 11
Allows administrators to configure bundles to work with this module.

Code

function date_repeat_entity_admin_settings() {
  $form = array();
  $form['#prefix'] = '<h2>' . t('Date Repeat Entity Administration') . '</h2>';

  // Get node entity bundles.
  $bundles = node_type_get_names();

  // If variable has never been initialized set all values to zero.
  if (is_null(variable_get('date_repeat_entity_bundles_available'))) {
    $defaults = array_fill(0, count($bundles), 0);
  }
  else {
    $defaults = array_keys($bundles);
  }

  // Add checkboxes for each bundle in use.
  $form['date_repeat_entity_bundles_available'] = array(
    '#title' => t('Bundles available to date repeat entity'),
    '#type' => 'checkboxes',
    '#options' => $bundles,
    '#default_value' => variable_get('date_repeat_entity_bundles_available', $defaults),
    '#description' => t('Select the bundles (content types) that date repeat entity should work with.'),
  );

  // Append custom submit handler.
  $form['#submit'][] = 'date_repeat_entity_admin_settings_submit';
  return system_settings_form($form);
}