0

I think this is a Ctools context question. I'm writing my first Panels style plugin and am having trouble getting field values from nodes inside the pane. I'm basically trying to recreate the plugin from this tutorial, http://precessionmedia.com/blog/creating-custom-panels-style-plugin-background-image-support, but I have changed it from a region plugin to pane plugin. The pane contains a list of node fields generated by Views, and I need to get the info from an image field but I'm not sure how to proceed.

In the link above, the render region callback uses this function: ctools_context_keyword_substitute($string, $keywords, $contexts, $converter_options = array()), where $contexts is $vars['display']->context, but this array is empty for me. I'm also not sure what values to use for $string. In the example link above, $string is replaced by the value entered into the style plugin settings form and the example given in the tutorial plugin is %node:field_image, isn't this just a token? I'm not sure if this is the right token to use, but I believe the missing context array is what is breaking this function for me.

Thanks, any help is greatly appreciated.

0

I had to add a Relationship to the File from the Context section of the panel variant (e.g. File from Node (on Node: Image [field_featured_image])). Now you will be able to use %file:url in the image field. Basically, the token you use needs to be listed in the summary of contexts.

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.