'', 'description' => '', 'callback' => 'ctools_ruleset_ctools_access_check', 'settings form' => 'ctools_ruleset_ctools_access_settings', 'summary' => 'ctools_ruleset_ctools_access_summary', // This access plugin actually just contains child plugins that are // exportable, UI configured rulesets. 'get child' => 'ctools_ruleset_ctools_access_get_child', 'get children' => 'ctools_ruleset_ctools_access_get_children', ); /** * Merge the main access plugin with a loaded ruleset to form a child plugin. */ function ctools_ruleset_ctools_access_merge_plugin($plugin, $parent, $item) { $plugin['name'] = $parent . ':' . $item->name; $plugin['title'] = check_plain($item->admin_title); $plugin['description'] = check_plain($item->admin_description); // TODO: Generalize this in CTools. if (!empty($item->requiredcontexts)) { $plugin['required context'] = array(); foreach ($item->requiredcontexts as $context) { $info = ctools_get_context($context['name']); // TODO: allow an optional setting $plugin['required context'][] = new ctools_context_required($context['identifier'], $info['context name']); } } // Store the loaded ruleset in the plugin. $plugin['ruleset'] = $item; return $plugin; } /** * Get a single child access plugin. */ function ctools_ruleset_ctools_access_get_child($plugin, $parent, $child) { ctools_include('export'); $item = ctools_export_crud_load('ctools_access_ruleset', $child); if ($item) { return ctools_ruleset_ctools_access_merge_plugin($plugin, $parent, $item); } } /** * Get all child access plugins. */ function ctools_ruleset_ctools_access_get_children($plugin, $parent) { $plugins = array(); ctools_include('export'); $items = ctools_export_crud_load_all('ctools_access_ruleset'); foreach ($items as $name => $item) { $child = ctools_ruleset_ctools_access_merge_plugin($plugin, $parent, $item); $plugins[$child['name']] = $child; } return $plugins; } /** * Settings form for the 'by ruleset' access plugin */ function ctools_ruleset_ctools_access_settings(&$form, &$form_state, $conf) { $form['markup'] = array( '#value' => '