TitleCallback.php in Crumbs, the Breadcrumbs suite 7.2
File
lib/MonoPlugin/TitleCallback.php
View source
<?php
class crumbs_MonoPlugin_TitleCallback implements crumbs_MonoPlugin_FindTitleInterface {
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('Title'));
}
function findTitle($path, $item) {
if (!isset($this->callback)) {
$this->callback = crumbs()->callbackRestoration
->restoreCallback($this->module, $this->key, 'routeTitle');
}
if (!empty($this->callback)) {
return call_user_func($this->callback, $path, $item);
}
return NULL;
}
}