You are here

function finder_text_settings in Finder 7.2

Settings callback.

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

File

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

Code

function finder_text_settings(&$data, $finder, $finder_element_id) {
  $items =& $data['items'];
  $element =& $finder->elements[$finder_element_id];
  unset($items['groups'][2]['choices']);
  $items['default_value']['#form']['#settings']['default_value']['#type'] = 'textarea';
  $items['maxlength'] = array(
    '#group' => 'form',
    '#item' => array(
      '#title' => t('Max length'),
      '#value' => $finder
        ->esetting($element, 'maxlength') ? $finder
        ->esetting($element, 'maxlength') : t('No'),
    ),
    '#form' => array(
      'settings' => array(
        'maxlength' => array(
          '#type' => 'textfield',
          '#title' => t('Max length'),
          '#default_value' => $finder
            ->esetting($element, 'maxlength'),
          '#description' => t('The maximum amount of characters to accept as input.'),
          '#translatable' => FALSE,
        ),
      ),
    ),
  );
  $items['minlength'] = array(
    '#group' => 'form',
    '#item' => array(
      '#title' => t('Min length'),
      '#value' => $finder
        ->esetting($element, 'minlength') ? $finder
        ->esetting($element, 'minlength') : t('No'),
    ),
    '#form' => array(
      'settings' => array(
        'minlength' => array(
          '#type' => 'textfield',
          '#title' => t('Min length'),
          '#default_value' => $finder
            ->esetting($element, 'minlength'),
          '#description' => t('The minimum amount of characters to accept as input (if input is given).'),
          '#translatable' => FALSE,
        ),
      ),
    ),
  );
  $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('Width (in characters).'),
          '#translatable' => FALSE,
        ),
      ),
    ),
  );
  $items['rows'] = array(
    '#group' => 'form',
    '#item' => array(
      '#title' => t('Rows'),
      '#value' => $finder
        ->esetting($element, 'rows') ? $finder
        ->esetting($element, 'rows') : t('Textfield'),
    ),
    '#form' => array(
      'settings' => array(
        'rows' => array(
          '#type' => 'textfield',
          '#title' => t('Rows'),
          '#default_value' => $finder
            ->esetting($element, 'rows'),
          '#description' => t('Leave blank for a single line textfield.'),
          '#translatable' => FALSE,
        ),
      ),
    ),
  );
}