function 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

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;
}