You are here

function _custom_breadcrumbs_load_for_type in Custom Breadcrumbs 7

Same name and namespace in other branches
  1. 5 custom_breadcrumbs.module \_custom_breadcrumbs_load_for_type()
  2. 6 custom_breadcrumbs.module \_custom_breadcrumbs_load_for_type()
1 call to _custom_breadcrumbs_load_for_type()
custom_breadcrumbs_node_view in ./custom_breadcrumbs.module
Implements hook_node_view().

File

./custom_breadcrumbs.module, line 118
Provide custom breadcrumbs for node-type pages.

Code

function _custom_breadcrumbs_load_for_type($node) {
  $result = db_query('SELECT * FROM {custom_breadcrumb} WHERE node_type = :node_type', array(
    ':node_type' => $node->type,
  ));
  while ($breadcrumb = $result
    ->fetchObject()) {
    if (!empty($breadcrumb->visibility_php)) {

      // Use PHP code to check the visibility.
      ob_start();
      $visibility = eval(trim($breadcrumb->visibility_php));
      ob_end_clean();
      if ($visibility == TRUE) {
        return $breadcrumb;
      }
    }
    else {
      return $breadcrumb;
    }
  }
}