1

When a node is rendered in a panel pane, hook_node_view() is not invoked. (I use Panels 7.x-3.4.) Is there any alternative to change rendered node content in any other hook?

I have tried with hook_ctools_render_alter(), but the HTML output of the node is presented as one large string. I need to change node content in one particular field, so I need to access a $node variable as an array, as it happens with hook_node_view(). I need to execute custom PHP for changing the output of one of the fields.

4
  • hook_panels_pane_content_alter - contains HTML output as a string in $content variable, so I cannot use it as an array before rendering Jun 22, 2016 at 8:15
  • hook_panels_pane_prerender - contains some configuration parameters of pane, but I don't see possibility to change part of content there Jun 22, 2016 at 8:21
  • hook_panels_pre_render - I don't see as option too, it is higher level of settings from whole display and panel Jun 22, 2016 at 8:25

1 Answer 1

0

If you are just editing one field you can use template_preprocess_field(), hook_field_display_alter(), or hook_field_display_ENTITY_TYPE_alter(). Those should also fire in other contexts if you use that field outside the panel pane in the future (which may be a good or bad side-effect depending on your context).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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