You are here

function finder_select_settings in Finder 7.2

Settings callback.

1 string reference to 'finder_select_settings'
select.inc in plugins/element_handler/select.inc
The finder select element handler plugin.

File

plugins/element_handler/select.inc, line 24
The finder select element handler plugin.

Code

function finder_select_settings(&$data, $finder, $finder_element_id) {
  $items =& $data['items'];
  $element =& $finder->elements[$finder_element_id];
  $items['size'] = array(
    '#group' => 'form',
    '#item' => array(
      '#title' => t('Size'),
      '#value' => $finder
        ->esetting($element, 'size') ? $finder
        ->esetting($element, 'size') : t('default'),
    ),
    '#form' => array(
      'settings' => array(
        'size' => array(
          '#type' => 'textfield',
          '#title' => t('Size'),
          '#default_value' => $finder
            ->esetting($element, 'size'),
          '#description' => t('The height (in lines) of the select list if multiple values are allowed.'),
          '#translatable' => FALSE,
        ),
      ),
    ),
  );
  $items['multiple'] = array(
    '#group' => 'form',
    '#item' => array(
      '#title' => t('Multiple'),
      '#value' => $finder
        ->esetting($element, 'multiple') ? t('Yes') : t('No'),
    ),
    '#form' => array(
      'settings' => array(
        'multiple' => array(
          '#type' => 'checkbox',
          '#title' => t('Allow multiple values'),
          '#default_value' => $finder
            ->esetting($element, 'multiple'),
        ),
      ),
    ),
  );
  $items['default_value']['#form']['settings']['default_value']['#type'] = 'textarea';
  $items['default_value']['#form']['settings']['default_value']['#size'] = 6;
  $items['default_value']['#form']['settings']['default_value']['#description'] = t('One per line for multiple values.');
  $items['empty'] = array(
    '#group' => 'form',
    '#item' => array(
      '#title' => t('Empty choice'),
      '#value' => $finder
        ->esetting($element, 'empty') ? $finder
        ->esetting($element, 'empty_text') : t('No'),
    ),
    '#form' => array(
      'settings' => array(
        'empty' => array(
          '#type' => 'radios',
          '#title' => t('Add an empty choice'),
          '#default_value' => $finder
            ->esetting($element, 'empty'),
          '#options' => array(
            '' => t('Do not add an empty choice.'),
            'prepend' => t('Prepend an empty choice to the top of the list.'),
            'append' => t('Append an empty choice to the bottom of the list.'),
          ),
        ),
        'empty_text' => array(
          '#type' => 'textfield',
          '#title' => t('Empty choice text'),
          '#default_value' => $finder
            ->esetting($element, 'empty_text'),
          '#description' => t("This can be used to create a choice such as 'please choose' or 'none of the above'."),
          '#process' => array(
            'ctools_dependent_process',
          ),
          '#dependency' => array(
            'radio:settings[empty]' => array(
              'prepend',
              'append',
            ),
          ),
        ),
      ),
    ),
  );
}