You are here

function _styleswitcher_style_name in Style Switcher 7.2

Same name and namespace in other branches
  1. 8.2 styleswitcher.module \_styleswitcher_style_name()
  2. 6.2 styleswitcher.module \_styleswitcher_style_name()
  3. 3.0.x styleswitcher.module \_styleswitcher_style_name()

Transliterates a human-readable name to a machine name.

Parameters

string $display_name: Style label.

Return value

string Transliterated name.

See also

Drupal.behaviors.machineName.transliterate()

drupal_clean_css_identifier()

drupal_html_id()

2 calls to _styleswitcher_style_name()
styleswitcher_active_style_path in ./styleswitcher.module
Finds the style active for current user and returns its path.
styleswitcher_theme_styles in ./styleswitcher.module
Returns a list of styles provided by a theme.

File

./styleswitcher.module, line 602
Module's hooks implementations and helper functions.

Code

function _styleswitcher_style_name($display_name) {
  $name = drupal_strtolower($display_name);
  $name = strtr($name, array(
    ' ' => '_',
    '-' => '_',
  ));
  $name = preg_replace('/[^a-z0-9_]/', '', $name);
  return $name;
}