You are here

function fieldset_helper_state_manager_get_path in Fieldset helper 6.2

Same name and namespace in other branches
  1. 7.2 fieldset_helper.module \fieldset_helper_state_manager_get_path()

Check if a path matches any pattern in a set of patterns.

Return value

The path to save current page's element to.

1 call to fieldset_helper_state_manager_get_path()
fieldset_helper_state_manager_get_lookup_id in ./fieldset_helper.module
Get the lookup id for the $element_id in the current path.

File

./fieldset_helper.module, line 238

Code

function fieldset_helper_state_manager_get_path() {
  static $path;
  if (isset($path)) {
    return $path;
  }
  $path = $_GET['q'];
  if ($pages = variable_get('fieldset_helper_global_pages', '')) {
    $pages = preg_split('/\\s+/', $pages);
    foreach ($pages as $page) {
      $pattern = '/^' . str_replace('\\*', '.*', preg_quote($page, '/')) . '$/';
      if (preg_match($pattern, $path)) {
        $path = $page;
        break;
      }
    }
  }

  // Run all hook implementations for hook_fieldset_helper_path_alter().
  foreach (module_implements('fieldset_helper_path_alter') as $module) {
    $function = $module . '_fieldset_helper_path_alter';
    $function($path);
  }
  return $path;
}