7 * Sample relationship plugin.
9 * We take a simplecontext, look in it for what we need to make a relcontext, and make it.
10 * In the real world, this might be getting a taxonomy id from a node, for example.
14 * Plugins are described by creating a $plugin array which will be used
15 * by the system that includes this file.
18 'title' => t("Relcontext from simplecontext"),
19 'keyword' => 'relcontext',
20 'description' => t('Adds a relcontext from existing simplecontext.'),
21 'required context' => new
ctools_context_required(t('Simplecontext'), 'simplecontext'),
22 'context' => 'ctools_relcontext_from_simplecontext_context',
23 'settings form' => 'ctools_relcontext_from_simplecontext_settings_form',
27 * Return a new context based on an existing context.
29 function ctools_relcontext_from_simplecontext_context($context = NULL
, $conf) {
30 // If unset it wants a generic, unfilled context, which is just NULL.
31 if (empty($context->data
)) {
32 return ctools_context_create_empty('relcontext', NULL
);
35 // You should do error-checking here.
37 // Create the new context from some element of the parent context.
38 // In this case, we'll pass in the whole context so it can be used to
39 // create the relcontext.
40 return ctools_context_create('relcontext', $context);
44 * Settings form for the relationship.
46 function ctools_relcontext_from_simplecontext_settings_form($conf) {
47 // We won't configure it in this case.