Accessing another box #122
-
How can we access another box data? My use case: the actual How can I fetch this |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You can access the current boxes page using the Once you've got the page, you can access all boxes using the Be aware that this logic must be executed somewhere before the page title is rendered in the document, otherwise your change won't have any effect. Edit: inside the box partial itself, you can access the page using |
Beta Was this translation helpful? Give feedback.
-
Thanks, it worked!
|
Beta Was this translation helpful? Give feedback.
You can access the current boxes page using the
boxesPage
variable in Twig. If you are using PHP code, you can find theboxesPage
variable set on the controller (i believe the property is namedvars
).Once you've got the page, you can access all boxes using the
->boxes
relation, and check if yourpageTitle
box is in there. If so, change the page's title.Be aware that this logic must be executed somewhere before the page title is rendered in the document, otherwise your change won't have any effect.
Edit: inside the box partial itself, you can access the page using
box.page