You are here

function overlay_paths_match_width in Overlay Paths 7

Return a valid CSS width value from the given string.

2 calls to overlay_paths_match_width()
overlay_paths_admin_form_paths_element_validate in overlay_paths_ui/overlay_paths_ui.admin.inc
Form validation callback.
overlay_paths_overlay_child_initialize in ./overlay_paths.module
Implements hook_overlay_child_initialize().

File

./overlay_paths.module, line 214
The overlay paths module.

Code

function overlay_paths_match_width($width) {
  $matches = array();
  if (preg_match('#^\\d+(px|em|%)?$#', $width, $matches)) {
    $width = $matches[0];
    if (empty($matches[1])) {
      $width .= 'px';
    }
    return $width;
  }
  return FALSE;
}