You are here

function bat_options_get_machine_name in Booking and Availability Management Tools for Drupal 8

Same name and namespace in other branches
  1. 7 modules/bat_options/bat_options.module \bat_options_get_machine_name()

Converts option human name to its machine name.

Parameters

string $option_name: The human option name.

string $pattern: The pattern used to convert. By default "/[^a-z0-9_]+/".

string $replacement: The replacement string. By default "_".

Return value

string The option machine name.

File

modules/bat_options/bat_options.module, line 74

Code

function bat_options_get_machine_name($option_name, $pattern = '/[^a-z0-9_]+/', $replacement = '_') {
  return preg_replace($pattern, $replacement, mb_strtolower($option_name));
}