You are here

function context_admin_term_childless_access_check in Contextual Administration 6

Same name and namespace in other branches
  1. 7 plugins/access/term_childless.inc \context_admin_term_childless_access_check()

Check for access.

1 string reference to 'context_admin_term_childless_access_check'
term_childless.inc in plugins/access/term_childless.inc
Provides access handler based upon the lack of child terms for the term we're on.

File

plugins/access/term_childless.inc, line 38
Provides access handler based upon the lack of child terms for the term we're on.

Code

function context_admin_term_childless_access_check($conf, $context) {

  // Per the example in node type in core ctools
  if (empty($context) || empty($context->data) || empty($context->data->tid)) {
    return FALSE;
  }
  $result = db_result(db_query("SELECT tid FROM {term_hierarchy} WHERE parent = %d", $context->data->tid));
  if ($result) {
    return FALSE;
  }
  else {
    return TRUE;
  }
  return FALSE;
}