I need to include a subject type as a required context for a ctools content type plugin? How and where is context set for the ctools plugin?


You can define the required context in the plugin definition array. Use the 'required context' key and the ctools_context_required class.

Here are a few lines of stripped down code you can find in the CTools Plugin Example module:

 * Plugins are described by creating a $plugin array which will be used
 * by the system that includes this file.
$plugin = array(
  'title' => t('Simplecontext content type'),
  'description' => t('Simplecontext content type - works with a simplecontext context.'),
  'required context' => new ctools_context_required(t('Simplecontext'), 'simplecontext'),

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.