You are here

function finder_buttons_settings in Finder 7.2

Settings callback.

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

File

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

Code

function finder_buttons_settings(&$data, $finder, $finder_element_id) {
  $items =& $data['items'];
  $element =& $finder->elements[$finder_element_id];
  $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',
            ),
          ),
        ),
      ),
    ),
  );
}