0

i am actualy trying to read a field value in my panelized node.

I want to recieve the data in the red marked field, as u can see in my screenshot.

enter image description here

I tried to following:

<?php print_r($display->context['panelizer']['data']['field_centerpage_layout'][0]['value']); ?>

But I recieve this Error:

Fatal error: Cannot use object of type ctools_context as array in C:\seu\xampp\htdocs\iptp\sites\all\themes\mytheme\plugins\layouts\he_two_70_30\he-two-70-30.tpl.php on line 29

I would be thankful for any kind of help :-)

1

As you can see from your Krumo output (plus the very descriptive error message), data is an object, not an array. I'd imagine $display->context['panelizer'] is also an object but it's hard to say as you haven't mentioned in your question how that's populated. You should use either

$display->context['panelizer']['data']->field_centerpage_layout[0]['value']

or

$display->context['panelizer']->data->field_centerpage_layout[0]['value']

Probably the second one.

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.