You are here

function masked_input_field_widget_settings_form in Masked Input 7.2

Implements hook_field_widget_settings_form().

File

./masked_input.module, line 176
Provides a form element, Field widget, and simple API for using the Masked Input jQuery plugin.

Code

function masked_input_field_widget_settings_form($field, $instance) {
  $settings = $instance['widget']['settings'];
  $definitions = masked_input_view_configured_definitions();
  $form['size'] = array(
    '#type' => 'textfield',
    '#title' => t('Size of textfield'),
    '#size' => '3',
    '#default_value' => $settings['size'],
    '#element_validate' => array(
      '_element_validate_integer_positive',
    ),
    '#required' => TRUE,
  );
  $form['mask'] = array(
    '#type' => 'textfield',
    '#title' => t('Mask'),
    '#description' => '',
    '#default_value' => $settings['mask'],
  );
  $form['mask']['#description'] .= t('A mask is defined by a format made up of mask literals and mask definitions. Any character not in the definitions list below is considered a mask literal. Mask literals will be automatically entered for the user as they type and will not be able to be removed by the user.') . ' ';
  $form['mask']['#description'] .= t('Here is a list of definitions that already exist, you can create more at !link', array(
    '!link' => l('admin/config/user-interface/masked_input', 'admin/config/user-interface/masked_input', array(
      'query' => array(
        'destination' => $_GET['q'],
      ),
    )),
  ));
  $form['mask']['#description'] .= render($definitions);
  $form['placeholder'] = array(
    '#type' => 'textfield',
    '#size' => 1,
    '#title' => t('Placeholder'),
    '#description' => t('Optionally, if you are not satisfied with the underscore ("_") character as a placeholder, you may pass an optional argument to the masked_input method.'),
    '#default_value' => $settings['placeholder'],
  );
  return $form;
}