You are here

function closeblock_settings_elemnts in Close Block 6

Closeblock settings form elements

Parameters

$settings:

Return value

Array of form elements

2 calls to closeblock_settings_elemnts()
closeblock_block_admin_configure in includes/closeblock.form.inc
Add Closeblock settings to block settings form
closeblock_system_theme_settings in includes/closeblock.form.inc
Add Closeblock settings to theme settings form

File

includes/closeblock.form.inc, line 30

Code

function closeblock_settings_elemnts($settings) {
  $form['closeblock_type'] = array(
    '#type' => 'radios',
    '#title' => t('Block close behavior'),
    '#options' => array(
      1 => t('None.'),
      2 => t('Slide Up.'),
      3 => t('Fade Out'),
    ),
    '#default_value' => $settings['closeblock_type'],
  );
  $form['closeblock_speed'] = array(
    '#type' => 'select',
    '#title' => t('Animation speed'),
    '#options' => drupal_map_assoc(array(
      '50',
      '100',
      '200',
      '300',
      '400',
      '500',
      '700',
      '1000',
      '1300',
    )),
    '#description' => t('The animation speed in milliseconds.'),
    '#default_value' => $settings['closeblock_speed'],
  );
  $form['closeblock_save'] = array(
    '#type' => 'checkbox',
    '#title' => t('Save state for user'),
    '#default_value' => $settings['closeblock_save'],
    '#description' => t('Save state of block to database. If checked, the block will be hidden automatically when page is loaded.'),
  );
  $form['closeblock_count'] = array(
    '#type' => 'textfield',
    '#title' => t('How many times show'),
    '#default_value' => $settings['closeblock_count'],
    '#description' => t('How many times block will be appear until the block will not be hidden permanently.'),
  );
  $form['closeblock_frequency'] = array(
    '#type' => 'textfield',
    '#title' => t('Frequency'),
    '#default_value' => $settings['closeblock_frequency'],
    '#description' => t('Eq: <em>+1 day</em>, <em>+3 weeks</em>.'),
  );

  // Use ctools to hide elements
  if (module_exists('ctools')) {
    ctools_include('dependent');
    $form['closeblock_type']['#dependency'] = $form['closeblock_speed']['#dependency'] = $form['closeblock_save']['#dependency'] = array(
      'edit-closeblock-custom' => array(
        1,
      ),
    );
    $form['closeblock_count']['#dependency'] = $form['closeblock_frequency']['#dependency'] = array(
      'edit-closeblock-custom' => array(
        1,
      ),
      'edit-closeblock-save' => array(
        1,
      ),
    );
    if (empty($settings['theme'])) {
      $form['closeblock_count']['#dependency_count'] = $form['closeblock_frequency']['#dependency_count'] = 2;
    }
  }
  return $form;
}