You are here

protected function DatalayerSettingsForm::keyReplacementsToArray in dataLayer 8

File

src/Form/DatalayerSettingsForm.php, line 90

Class

DatalayerSettingsForm
Defines a form that configures datalayer module settings.

Namespace

Drupal\datalayer\Form

Code

protected function keyReplacementsToArray($replacements) {
  $storage = [];
  $labels = explode("\r\n", $replacements);
  array_filter($labels);
  foreach ($labels as $label) {
    if (strpos($label, '|') !== FALSE) {
      $tmp = explode('|', $label);
      $storage[$tmp[0]] = $tmp[1];
    }
  }
  return $storage;
}