symphonycms/symphony-2 — Issue #1075: Page class `_context` is public
Author: nickdunn
Created: 2012-03-08 09:33:30+00:00
State: open

Now that `_parent` is a thing of the past, we will see many extensions break. Namely subscribing to `initaliseAdminPageHead` and using:

$page = $context['parent']->Page;

This should go into the 2.3 migration guide as being changed to:

$page = Administration::instance()->Page;

Since the delegate no longer contains the page as it is globally available via the above accessor.

However there is still a need to access a page's "context" which is currently done via:

$page->_context

The naming of this suggests to me it should really be private but having migrated from PHP4 where `private` did not exist, this member is now erroneously public. Now, the information within `_context` can be obtained by calling:

Administration::instance()->getPageCallback()

(Not sure why it is called "callback". Callback from where?) However, we found some time ago that calling this without first checking the type of the (`instanceof contentPublish`) would throw an error:

Cannot request a page callback without first specifying the page.

We never got to the bottom of this.

So my issues are:

1. The change to this delegate is missing from the migration guide (loads of extensions use it, so it should be explicit)
2. Should `$_context` be public, or should we get grabbing context via `getPageCallback()` instead?