Closed mbaxter91288 closed 7 years ago
Hi,
The master ref is always the master, it's not the ref from the preview or experiment cookie. If you explicitly ask for the master, you won't get the preview or experiment ref.
Note that there is now a shortcut function that will automatically read the preview and experiment cookies:
https://github.com/prismicio/php-kit/blob/master/src/Prismic/Api.php#L423
Thanks for responding.
I saw the shortcut function and this is what I was referring to. In lines 433 to 439 it sets a $ref
variable either by cookie or falls back to master, but then in line 440 never uses it. I can't see what the $ref
variable is used for if it wasn't meant to be used there :-/
Hey, that's correct, thank you for the heads up.
Hi,
Not sure if I'm missing something or not but I've been playing around with getting the preview functionality working and been digging into the code and looking at the query() function within Api.php line 432. It begins by trying to set the
$ref
and if it cannot find either the preview or experiment cookies it sets themaster()->getRef()
. But then in line 444 it doesn't use the above mentioned$ref
it gets the master:If I change the code (for testing only of course) to the below then my previewing works perfect.
Any help would be appreciated.
Regards, MAt