ParentPathCallback.php in Crumbs, the Breadcrumbs suite 7.2
File
lib/MonoPlugin/ParentPathCallback.php
View source
<?php
class crumbs_MonoPlugin_ParentPathCallback implements crumbs_MonoPlugin_FindParentInterface {
protected $callback;
protected $module;
protected $key;
function __construct($callback, $module, $key) {
$this->callback = $callback;
$this->module = $module;
$this->key = $key;
}
function __sleep() {
return array(
'module',
'key',
);
}
function describe($api) {
$api
->titleWithLabel(t('Callback result.'), t('Parent'));
}
function findParent($path, $item) {
if (!isset($this->callback)) {
$this->callback = crumbs()->callbackRestoration
->restoreCallback($this->module, $this->key, 'routeParent');
}
if (!empty($this->callback)) {
return call_user_func($this->callback, $path, $item);
}
return NULL;
}
}