You are here

function homebox_configure_form in Homebox 6.3

Same name and namespace in other branches
  1. 6 homebox.admin.inc \homebox_configure_form()
  2. 6.2 homebox.admin.inc \homebox_configure_form()
  3. 7.3 homebox.admin.inc \homebox_configure_form()
  4. 7.2 homebox.admin.inc \homebox_configure_form()

Forms for administration settings

Parameters

$form_state:

Return value

$form

1 string reference to 'homebox_configure_form'
homebox_menu in ./homebox.module
Implementation of hook_menu().

File

./homebox.admin.inc, line 661
Homebox admin file, takes care admin interface for homebox

Code

function homebox_configure_form(&$form_state, $page) {
  drupal_set_title(t('@page_name settings', array(
    '@page_name' => $page->settings['title'],
  )));
  $form['columns'] = array(
    '#type' => 'select',
    '#title' => t('Number of columns'),
    '#default_value' => $page->settings['regions'],
    '#options' => array(
      '1' => 1,
      '2' => 2,
      '3' => 3,
      '4' => 4,
      '5' => 5,
      '6' => 6,
      '7' => 7,
      '8' => 8,
      '9' => 9,
    ),
    '#description' => t('Set the number of columns you want to activate for this Homebox page.'),
  );
  $form['cache'] = array(
    '#type' => 'select',
    '#title' => t('Use blocks cache?'),
    '#default_value' => $page->settings['cache'],
    '#options' => array(
      0 => t('Don\'t use'),
      1 => t('Use if available'),
    ),
    '#description' => t('Homebox will use the blocks cache if available for the rendering of the blocks. This can greatly improve performances, but has the drawback to break Views blocks that uses Ajax AND are using <strong>Block settings: Caching</strong>. You can use this option only if the Views blocks used in your homebox that use Ajax are set to <strong>Block settings: Caching:</strong> Do not cache.'),
  );
  $form['widths'] = array(
    '#type' => 'fieldset',
    '#title' => t('Custom column widths'),
    '#description' => t('
      Optionally set custom widths for each available region.
      If these values are omitted, the regions will all be the same width, set horizontally.<br/>
      <img src="' . base_path() . drupal_get_path('module', 'homebox') . '/images/layout-example.png" alt="Layout" style="float:right;"/>
      To achieve a layout like the image to the right, you would set the column count to 4, with widths of 100, 50, 50, and 100.
    '),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  for ($i = 1; $i <= 9; $i++) {
    $form['widths']['width_' . $i] = array(
      '#type' => 'textfield',
      '#title' => t('Column #!number width', array(
        '!number' => $i,
      )),
      '#default_value' => $page->settings['widths'][$i] ? $page->settings['widths'][$i] : '',
      '#size' => 10,
      '#field_suffix' => '%',
    );
  }
  $form['color'] = array(
    '#type' => 'fieldset',
    '#title' => t('Boxes colors customization'),
    '#description' => t('Here you can set colors that users can use to customize their boxes.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['color']['colors_enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Can users set custom colors for each boxes?'),
    '#default_value' => $page->settings['color'],
  );
  if (module_exists('colorpicker')) {
    $form['color']['homebox_colorpicker'] = array(
      '#type' => 'colorpicker',
      '#title' => t('Color picker'),
      '#description' => t('Click an input to choose a color.'),
    );
    for ($i = 0; $i < HOMEBOX_NUMBER_OF_COLOURS; $i++) {
      $form['color']['block_color_' . $i] = array(
        '#type' => 'colorpicker_textfield',
        '#title' => t('Color #!number', array(
          '!number' => $i,
        )),
        '#description' => t('Enter an hexadecimal value prefixed with #.'),
        '#default_value' => $page->settings['colors'][$i] ? $page->settings['colors'][$i] : '#E4F0F8',
        '#colorpicker' => 'homebox_colorpicker',
        '#size' => 7,
        '#maxlength' => 7,
      );
    }
  }
  else {
    for ($i = 0; $i < HOMEBOX_NUMBER_OF_COLOURS; $i++) {
      $form['color']['block_color_' . $i] = array(
        '#type' => 'textfield',
        '#title' => t('Color #!number', array(
          '!number' => $i,
        )),
        '#description' => t('Enter an hexadecimal value, ex: #ff33dd'),
        '#default_value' => $page->settings['colors'][$i] ? $page->settings['colors'][$i] : '#E4F0F8',
        '#size' => 7,
        '#maxlength' => 7,
      );
    }
    $form['color']['message'] = array(
      '#type' => 'item',
      '#value' => t('If you had the <a href="@url">Color picker</a> module enabled you could choose colors more easily.', array(
        '@url' => 'http://drupal.org/project/colorpicker',
      )),
    );
  }
  $form['name'] = array(
    '#type' => 'value',
    '#value' => $page->name,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}