You are here

function _maskinput_definitions_element in Masked Input 8

Helper function: builds masked input definition form element.

2 calls to _maskinput_definitions_element()
MaskedInputSettingsForm::buildForm in src/MaskedInputSettingsForm.php
Form constructor.
MaskedInputSettingsForm::_masked_input_definitions_add_another_submit in src/MaskedInputSettingsForm.php
Ajax submission callback: adds another definition form element.

File

src/MaskedInputSettingsForm.php, line 114

Namespace

Drupal\masked_input

Code

function _maskinput_definitions_element($delta = 'new', $definitions = array()) {
  return array(
    '#type' => 'container',
    '#attributes' => array(),
    'character' => array(
      '#type' => 'textfield',
      '#size' => 1,
      '#maxlength' => 1,
      '#default_value' => isset($definitions[$delta]['character']) ? $definitions[$delta]['character'] : '',
    ),
    'regex' => array(
      '#type' => 'textfield',
      '#size' => 40,
      '#default_value' => isset($definitions[$delta]['regex']) ? $definitions[$delta]['regex'] : '',
    ),
    'description' => array(
      '#type' => 'textfield',
      '#size' => 40,
      '#default_value' => isset($definitions[$delta]['description']) ? $definitions[$delta]['description'] : '',
    ),
  );
}