You are here

function masked_input_install in Masked Input 8

Implements hook_install().

File

./masked_input.module, line 105
Contains masked_input.module.

Code

function masked_input_install() {

  // Set default values for config which require dynamic values.
  $default_definitions = _masked_input_default_definitions();
  $definitions = array();
  foreach ($default_definitions as $i => $rows) {
    $definitions[$i]['character'] = $rows['0']['data'];
    $definitions[$i]['regex'] = $rows['1']['data'];
    $definitions[$i]['description'] = $rows['2']['data'];
  }
  \Drupal::service('config.factory')
    ->getEditable('masked_input.settings')
    ->set('masked_input_definitions', $definitions)
    ->save();
}