You are here

static function crumbs_Util::buildMethodSuffix in Crumbs, the Breadcrumbs suite 7.2

This function has exactly one possible input value for each possible return value, except the return value FALSE.

Parameters

string $route: The router path can contain any character, but will typically have a format like "node/%/edit".

Return value

string or FALSE A string that can be used as a method suffix, or FALSE, where that is not possible. The route "node/%/edit" will resolve as "node_x_edit".

1 call to crumbs_Util::buildMethodSuffix()
crumbs_InjectedAPI_Collection_PluginCollection::analyzeRoutePluginMethods in lib/InjectedAPI/Collection/PluginCollection.php

File

lib/Util.php, line 50

Class

crumbs_Util
Static methods that don't fit elsewhere. Ideally these are all stateless and do not depend on anything. But at least one of them is not..

Code

static function buildMethodSuffix($route) {
  $method_suffix = strtolower($route);
  $method_suffix = preg_replace('#[^a-z0-9\\%]#', '_', $method_suffix);
  $method_suffix = strtr($method_suffix, array(
    '%' => 'x',
  ));
  $reverse = self::routeFromMethodSuffix($method_suffix);
  if ($reverse === $route) {
    return $method_suffix;
  }
  return FALSE;
}