Get attribute of unapproved page

Permalink
This is a bit of a deep question, but before I go diving into the C5 source code I thought I'd ask and see if anyone has any ideas about this.

I have a package that runs a scheduled task that programmatically creates empty pages with a few attributes set. It creates them in unapproved mode, then later another scheduled task adds more content and attributes and approves them so they show up on the site.

This (mostly) works great. The problem I'm having, is that for pages that aren't approved yet, the page object returned by PageList doesn't return a value for getAttribute('my_attribute'). The attribute is there, because it shows up when the page is approved, and I can also see it in the GUI, but until the page is approved, I can't seem to get to it programmatically.

I see Collection::getAttribute() is passing the call to CollectionVersion::getAttribute(), and since there's no "version" yet, maybe that's why it's not returning the value? But it's *there* somewhere, so surely there's some way to get to it.

Using Concrete 5.5.2.1 if that makes any difference.

chemmett
 
formigo replied on at Permalink Reply
formigo
Not sure. But if that's the case and you can't get the attribute when not approved, why not create the page, approve it but set permissions on the page so it can't be seen. Your second cron job can alter the permissions to make it visible?

That's just me thinking out loud - it might help