We are using the ECK module where we have created component eck_highlight (machine name). How would we be able to modify the variable array using a preprocess hook?

Eck_highlight component has this field:

  • Field Reference to content types: basic, article, and event


Call the preprocess to store 'info' array to vars (i.e. vars['info']). The info variable will be passed into the Twig template so we can use to output information.

mymodule_preprocess_eck_highlight(&$vars) {
    $vars['info'] += [
       'id' => 'some-id',
       'height' => 'some-height',
       'width' => 'some-width',
       'src' => 'src1'

We have tried to do the following but cannot alter the variables.

  1. mymodule_preprocess_eck_highlight(&$vars)
  2. mytheme_preprocess_eck_highlight(&$vars)
  • Is this the correct hook to use?
    – Kevin
    Dec 8, 2017 at 21:35
  • I ended up finding the correct hook. I will update the question. Dec 8, 2017 at 22:58

1 Answer 1


I am adding an answer so anyone who comes across this that i was able to resolve the issue. I had to use mymodule_preprocess_eck_entity(&$vars).

When i tried to use the machine name in place of eck_entity, it did not work.

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.