Render cTools Panel Page

Public

Programmatically render a cTools panel variant with a string context argument.

</> CopyGet raw version
php
  1. $subtask_id = 'page_machine_name';
  2. $page = page_manager_page_load($subtask_id);
  3. $task = page_manager_get_task($page->task);
  4. $subtask = page_manager_get_task_subtask($task, $subtask_id);
  5. $context_content = 'The content to pass as the string context argument';
  6. $context = new ctools_context('string', $context_content);
  7. $context->keyword = 'argument_name'; // The argument name, is used when replacing content in markup.
  8. $context->plugin = 'string';
  9. $contexts[] = $context;
  10. $args = array($context_content);
  11. $output = ctools_context_handler_render($task, $subtask, $contexts, $args);