You are here

public function ConfigPermListForm::configPermsGenerateMachineName in Custom Permissions 8

Same name and namespace in other branches
  1. 8.2 src/Form/ConfigPermListForm.php \Drupal\config_perms\Form\ConfigPermListForm::configPermsGenerateMachineName()

Generate a machine name given a string.

2 calls to ConfigPermListForm::configPermsGenerateMachineName()
ConfigPermListForm::submitForm in src/Form/ConfigPermListForm.php
Form submission handler.
ConfigPermListForm::validateForm in src/Form/ConfigPermListForm.php
Form validation handler.

File

src/Form/ConfigPermListForm.php, line 243

Class

ConfigPermListForm
Class ConfigPermListForm.

Namespace

Drupal\config_perms\Form

Code

public function configPermsGenerateMachineName($string) {
  return strtolower(preg_replace('/[^a-zA-Z0-9_]+/', '_', $string));
}