You are here

function path_breadcrumbs_term_depth_ctools_access_check in Path Breadcrumbs 7.3

Check for access.

1 string reference to 'path_breadcrumbs_term_depth_ctools_access_check'
path_breadcrumbs_term_depth.inc in plugins/access/path_breadcrumbs_term_depth.inc
Plugin to provide access control based on term depth.

File

plugins/access/path_breadcrumbs_term_depth.inc, line 57
Plugin to provide access control based on term depth.

Code

function path_breadcrumbs_term_depth_ctools_access_check($conf, $context) {
  if (empty($context) || empty($context->data) || empty($context->data->vid) || empty($context->data->tid)) {
    return FALSE;
  }
  $depth = _path_breadcrumbs_term_depth($context->data->tid);
  switch ($conf['operator']) {
    case '<=':
      if ($depth <= $conf['depth']) {
        return TRUE;
      }
      break;
    case '>=':
      if ($depth >= $conf['depth']) {
        return TRUE;
      }
      break;
    case '=':
    default:
      if ($depth == $conf['depth']) {
        return TRUE;
      }
  }
  return FALSE;
}