You are here

function custom_breadcrumbs_is_visible in Custom Breadcrumbs 6.2

Same name and namespace in other branches
  1. 7.2 custom_breadcrumbs.module \custom_breadcrumbs_is_visible()

Determines breadcrumb visibility by evaluating PHP code.

Parameters

$breadcrumb: The breadcrumb object.

$objs: An array of objects (node, taxonomy, or view) that can be used in the php code.

Return value

TRUE if the breadcrumb should be displayed, FALSE otherwise.

2 calls to custom_breadcrumbs_is_visible()
custom_breadcrumbs_select_breadcrumb in ./custom_breadcrumbs.module
Selects a breadcrumb from an array of breadcrumbs.
_custom_breadcrumbs_paths_set_breadcrumb in custom_breadcrumbs_paths/custom_breadcrumbs_paths.module
Checks for a custom breadcrumb at the current path and sets it if one is found.

File

./custom_breadcrumbs.module, line 739
Provide custom breadcrumbs for node-type pages and base functionality for submodules to add custom breadcrumbs for other types of pages.

Code

function custom_breadcrumbs_is_visible($breadcrumb, $objs = array()) {
  $visibility = TRUE;
  if (isset($breadcrumb->visibility_php)) {

    // Guard against hidden spaces.
    $trimmed = trim($breadcrumb->visibility_php);
    if ($trimmed != '') {

      // Provide access to objects by standard variable names.
      foreach ($objs as $key => $obj) {
        ${$key} = is_object($obj) ? drupal_clone($obj) : $obj;
      }
      ob_start();
      $visibility = eval($trimmed);
      ob_end_clean();
    }
  }
  return $visibility;
}