t("Simplecontext arg"), // Keyword to use for %substitution. 'keyword' => 'simplecontext', 'description' => t('Creates a "simplecontext" from the arg.'), 'context' => 'simplecontext_arg_context', // placeholder_form is used in panels preview, for example, so we can // preview without getting the arg from a URL. 'placeholder form' => array( '#type' => 'textfield', '#description' => t('Enter the simplecontext arg'), ), ); /** * Get the simplecontext context using the arg. In this case we're just going * to manufacture the context from the data in the arg, but normally it would * be an API call, db lookup, etc. */ function simplecontext_arg_context($arg = NULL, $conf = NULL, $empty = FALSE) { // If $empty == TRUE it wants a generic, unfilled context. if ($empty) { return ctools_context_create_empty('simplecontext'); } // Do whatever error checking is required, returning FALSE if it fails the test // Normally you'd check // for a missing object, one you couldn't create, etc. if (empty($arg)) { return FALSE; } return ctools_context_create('simplecontext', $arg); }