function ctools_access_new_test
Create default settings for a new access plugin.
Parameters
$plugin: The access plugin being used.
Return value
array A default configured test that should be placed in $access['plugins'];
1 call to ctools_access_new_test()
- ctools_access_ajax_add in includes/
context-access-admin.inc - AJAX callback to add a new access test to the list.
File
-
includes/
context.inc, line 2016
Code
function ctools_access_new_test($plugin) {
$test = array(
'name' => $plugin['name'],
'settings' => array(),
);
// Set up required context defaults.
if (isset($plugin['required context'])) {
if (is_object($plugin['required context'])) {
$test['context'] = '';
}
else {
$test['context'] = array();
foreach ($plugin['required context'] as $required) {
$test['context'][] = '';
}
}
}
$default = NULL;
if (isset($plugin['default'])) {
$default = $plugin['default'];
}
elseif (isset($plugin['defaults'])) {
$default = $plugin['defaults'];
}
// Setup plugin defaults.
if (isset($default)) {
if (is_array($default)) {
$test['settings'] = $default;
}
elseif (function_exists($default)) {
$test['settings'] = $default();
}
else {
$test['settings'] = array();
}
}
return $test;
}