function term_depth_term_depth_ctools_access_check

Check for access.

1 string reference to 'term_depth_term_depth_ctools_access_check'
term_depth.inc in term_depth/plugins/access/term_depth.inc
Plugin to provide access control based upon a parent term.

File

term_depth/plugins/access/term_depth.inc, line 81

Code

function term_depth_term_depth_ctools_access_check($conf, $context) {
    // As far as I know there should always be a context at this point, but this
    // is safe.
    if (empty($context) || empty($context->data) || empty($context->data->vid) || empty($context->data->tid)) {
        return FALSE;
    }
    _term_depth_convert_config_vid_to_vocabulary_name($conf);
    // Get the $vocabulary.
    if (!isset($conf['vocabulary'])) {
        return FALSE;
    }
    $vocab = taxonomy_vocabulary_machine_name_load($conf['vocabulary']);
    if ($vocab->vid != $context->data->vid) {
        return FALSE;
    }
    $depth = _term_depth($context->data->tid);
    return $depth == $conf['depth'];
}