Hey there.
I’m trying to build an elastic search index from my pages. Certain pages (like the search results page) should not end up in the elastic index, for these pages, I created a page attribute “Do not index”.
When the page contents change, I need to update the elastic index, however I can’t find a way to detect whether the page that’s being updated has the “Do not index” attribute. To be more precise, I cannot get the most up to date value of said attribute.
Let’s say I have a page that currently is indexed (“Do not index” is false). If I check the box for “Do not index” and submit, in my event listener I still get false
as the value of “Do not index”.
Here’s the code:
...
Events::addListener('on_page_update', function (PageEvent $event) use ($session) {
$page = $event->getPageObject();
dd($page->getAttribute('do_not_index')); // dumps false
});
...
Is there any way to get a set of all the changes for the page, or even just the new data? Any help is greatly appreciated!