Jump to content

Recommended Posts

Posted

Hey Ryan (and few of those 'I know core' devs ;))

I am doing little something, and I'd really like to get to the data user assigned to $page during template processing.

If I do this, for instance:

 $page->custom_value = 'test';

I can get the information about 'custom_value' existence from the $page object in both $page->data and $page->changes; Unfortunately, both of them are protected.

Of course data is even better, because there is value as well, but I thought that if I had the name even, I could get to content.

Is there any way around this? Thanks

Posted

You can call the getChanges() method on any object in ProcessWire and it'll return a plan array of field names that changed. So what I think you are looking for is $page->getChanges(). This assumes that change tracking is enabled for the page (which it usually is).

$page->setTrackChanges(true); // true to turn ON, false to turn OFF
$page->resetTrackChanges(true); // clear the change log and start tracking again
$changes = $page->getChanges();

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...