You are here

function recipe_admin_settings in Recipe 7.2

Same name and namespace in other branches
  1. 5 recipe.module \recipe_admin_settings()
  2. 6 recipe.admin.inc \recipe_admin_settings()
  3. 7 recipe.admin.inc \recipe_admin_settings()

Page callback: Constructs a form for configuring the Recipe module.

1 string reference to 'recipe_admin_settings'
recipe_menu in ./recipe.module
Implements hook_menu().

File

./recipe.admin.inc, line 11
Contains admin page callbacks, form validation, and form submission handlers.

Code

function recipe_admin_settings() {

  // System of measurement section
  $form['system_of_measurement'] = array(
    '#type' => 'fieldset',
    '#title' => t('System of measurement'),
  );
  $form['system_of_measurement']['recipe_preferred_system_of_measure'] = array(
    '#type' => 'radios',
    '#title' => t('Preferred system of measure'),
    '#default_value' => variable_get('recipe_preferred_system_of_measure', 0),
    '#options' => array(
      t('U.S. customary units'),
      t('SI/Metric'),
    ),
    '#description' => t('Which system of measure should be preferred where it is ambiguous.'),
    '#required' => TRUE,
  );
  $form['system_of_measurement']['recipe_preferred_system_of_measure_limit'] = array(
    '#type' => 'checkbox',
    '#title' => t('Limit UI to the preferred system of measure'),
    '#default_value' => variable_get('recipe_preferred_system_of_measure_limit', 0),
    '#return_value' => 1,
    '#description' => t('Limit unit selectbox to only preferred system of measure.  Does not affect import routines.'),
  );

  // Summary Section
  $form['recipe_summary'] = array(
    '#type' => 'fieldset',
    '#title' => t('Recipe summary'),
    '#description' => t('The recipe summary contains the yield, source, and prep time values.'),
  );
  $form['recipe_summary']['recipe_summary_location'] = array(
    '#type' => 'radios',
    '#title' => t('Recipe summary location'),
    '#return_value' => 1,
    '#default_value' => variable_get('recipe_summary_location', 0),
    '#options' => array(
      t('Node content'),
      t('Block'),
      t('Hidden'),
    ),
    '#description' => t('Where to show the recipe summary information.'),
    '#required' => TRUE,
  );
  $form['recipe_summary']['recipe_summary_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Recipe summary title'),
    '#default_value' => variable_get('recipe_summary_title', t('Summary')),
    '#size' => 35,
    '#maxlength' => 255,
    '#description' => t('The title shown above the recipe summary.'),
  );
  $form['recipe_recent_box'] = array(
    '#type' => 'fieldset',
    '#title' => t('Recent recipe box'),
  );
  $form['recipe_recent_box']['recipe_recent_box_enable'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show recent recipes box'),
    '#return_value' => 1,
    '#default_value' => variable_get('recipe_recent_box_enable', 1),
    '#description' => t('Show the recent recipes box on the recipes menu page.'),
    '#required' => FALSE,
  );
  $form['recipe_recent_box']['recipe_recent_box_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Box title'),
    '#default_value' => variable_get('recipe_recent_box_title', t('Latest recipes')),
    '#size' => 35,
    '#maxlength' => 255,
    '#description' => t('Title of the recent recipes box.'),
  );
  $form['recipe_recent_box']['recipe_recent_display'] = array(
    '#type' => 'select',
    '#title' => t('Recipes to display'),
    '#default_value' => variable_get('recipe_recent_display', 5),
    '#options' => drupal_map_assoc(array(
      0,
      5,
      10,
      15,
    )),
    '#description' => t('Sets the number of recent recipes that will be displayed in the Recent Recipes box. (0 = not displayed).'),
  );
  return system_settings_form($form);
}