1

I have a ctools content type plugin. It has a simple text field settings form. In there I am putting a token from the panel content e.g. %vn_subject:vn-subject-facebook-link. I am then rendering this into a template. However, it is just rendering out the token as above without processing it. How can I process the token if possible to retrieve the required field value? Thanks

3

The magic function is ctools_context_keyword_substitute

The key to getting this working is to make sure that you use the all contexts flag in your plugin configuration.

$plugin = array(
  'single' => TRUE,
  'title' => t('Instagram'),
  'category' => t('Content'),
  'all contexts' => TRUE,
);

/**
 * Render the custom content type.
 */
function MODULE_PANE_content_type_render($subtype, $conf, $panel_args, $context) {

  ....

  $replaced = ctools_context_keyword_substitute('your_string_with_%keywords', array(), $context);

  ....
}
1
  • Hi, thanks @Letharion. I have that function and trying to implement but having some issues. What is $keywords? What format does $contexts have to be in. and what $converter_options are availables :) Aug 15 '13 at 13:56

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.