You are here

function ctools_relcontext_from_simplecontext_context in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc \ctools_relcontext_from_simplecontext_context()

Return a new context based on an existing context.

1 string reference to 'ctools_relcontext_from_simplecontext_context'
relcontext_from_simplecontext.inc in ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc
Sample relationship plugin.

File

ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc, line 29
Sample relationship plugin.

Code

function ctools_relcontext_from_simplecontext_context($context = NULL, $conf) {

  // If unset it wants a generic, unfilled context, which is just NULL.
  if (empty($context->data)) {
    return ctools_context_create_empty('relcontext', NULL);
  }

  // You should do error-checking here.
  // Create the new context from some element of the parent context.
  // In this case, we'll pass in the whole context so it can be used to
  // create the relcontext.
  return ctools_context_create('relcontext', $context);
}