function custom_breadcrumbs_load_breadcrumbs in Custom Breadcrumbs 7.2
Same name and namespace in other branches
- 6.2 custom_breadcrumbs.module \custom_breadcrumbs_load_breadcrumbs()
Loads the custom breadcrumb from submodule table.
@codingStandardsIgnoreStart
Parameters
string $module: The name of the custom breadcrumbs submodule managing the requested breadcrumb.
string $table: The name of the table to limit the search to. This only needs to be provided if the submodule provides breadcrumbs from more than one table.
array $param: An array of the form 'field' => $value used in the SQL WHERE clause.
Return value
array if $param is empty, all breadcrumbs from the table will be returned as an array otherwise a single breadcrumb object is be returned.
23 calls to custom_breadcrumbs_load_breadcrumbs()
- custom_breadcrumbsapi_breadcrumb_alter in custom_breadcrumbsapi/
custom_breadcrumbsapi.module - Implements hook_breadcrumb_alter().
- custom_breadcrumbsapi_form in custom_breadcrumbsapi/
custom_breadcrumbsapi.module - Form builder; Displays an edit form for a module page breadcrumb.
- custom_breadcrumbsapi_preprocess in custom_breadcrumbsapi/
custom_breadcrumbsapi.module - Implements hook_preprocess().
- custom_breadcrumbs_form in ./
custom_breadcrumbs.admin.inc - Form builder to edit a custom breadcrumb record.
- custom_breadcrumbs_form_node_form_alter in ./
custom_breadcrumbs.module - Implements hook_form_BASE_FORM_ID_alter().
File
- ./
custom_breadcrumbs.module, line 785 - Main file for the Custom breadcrumbs.
Code
function custom_breadcrumbs_load_breadcrumbs($module, $table = NULL, $param = array(), $languages = array()) {
// @codingStandardsIgnoreEnd
static $breadcrumbs_cache = array();
$breadcrumbs = array();
$bc_info = module_invoke($module, 'cb_breadcrumb_info');
foreach ($bc_info as $info) {
if (!isset($table) || $info['table'] == $table) {
$cond_string = array();
$query = db_select($info['table'], 'c')
->fields('c');
// @codingStandardsIgnoreLine
if ($p = !empty($param)) {
foreach ($param as $key => $value) {
$query
->condition($key, $value);
$cond_string[] = $key . '_' . $value;
}
}
if (!empty($languages)) {
$query
->condition('language', $languages, 'IN');
$query
->orderBy('language', 'ASC');
}
$ckey = "{$info['table']}-{" . implode('_', $cond_string) . "}-" . implode('_', $languages);
if (isset($breadcrumbs_cache[$ckey])) {
$breadcrumbs = $breadcrumbs_cache[$ckey];
}
else {
$result = $query
->execute();
foreach ($result as $breadcrumb) {
if (!isset($breadcrumb->name)) {
$breadcrumb->name = isset($info['name_constructor']) ? $info['name_constructor']($breadcrumb) : $breadcrumb->{$info['field']};
}
$breadcrumb->breadcrumb_type = $info['type'];
$breadcrumbs[] = $breadcrumb;
}
$breadcrumbs_cache[$ckey] = $breadcrumbs;
}
}
}
return $breadcrumbs;
}