You are here

function ctools_plugin_example_arg_length_ctools_access_check in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 ctools_plugin_example/plugins/access/arg_length.inc \ctools_plugin_example_arg_length_ctools_access_check()

Check for access.

1 string reference to 'ctools_plugin_example_arg_length_ctools_access_check'
arg_length.inc in ctools_plugin_example/plugins/access/arg_length.inc
Plugin to provide access control/visibility based on length of simplecontext argument (in URL).

File

ctools_plugin_example/plugins/access/arg_length.inc, line 44
Plugin to provide access control/visibility based on length of simplecontext argument (in URL).

Code

function ctools_plugin_example_arg_length_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)) {
    return FALSE;
  }
  $compare = $context->arg_length > $conf['arg_length'];
  if ($compare && $conf['greater_than'] || !$compare && !$conf['greater_than']) {
    return TRUE;
  }
  return FALSE;
}