You are here

function crumbs_MonoPlugin_LegacyWrapper::findParent in Crumbs, the Breadcrumbs suite 7.2

Find candidates for the parent path.

Parameters

string $path: The path that we want to find a parent for.

array $item: Item as returned from crumbs_get_router_item()

Return value

string Parent path candidate.

Overrides crumbs_MonoPlugin_FindParentInterface::findParent

File

lib/MonoPlugin/LegacyWrapper.php, line 66

Class

crumbs_MonoPlugin_LegacyWrapper
A wrapper for legacy plugins with suffixed methods like findTitle__node_x().

Code

function findParent($path, $item) {
  $route = $item['route'];
  if (isset($this->findParentRouteMethods[$route])) {
    $method = $this->findParentRouteMethods[$route];
    if (method_exists($this->wrappedPlugin, $method)) {
      return $this->wrappedPlugin
        ->{$method}($path, $item);
    }
  }
  elseif (method_exists($this->wrappedPlugin, 'findParent')) {
    return $this->wrappedPlugin
      ->findParent($path, $item);
  }
  return NULL;
}