silverstripe/sapphire — pull request #997 by sekjal (2012-12-04 20:45:02+00:00)
Title: Bug 8056: Add Page parent page selection does not display page titles

Since commit b6017a7c9, ToArray() has taken to stripping out key values, leaving
only the numeric indices. This means that SelectionGroups can no longer label their
fields directly in the $items array; the $key value will always be the numeric index,
and thus so will the $title. The result in the CMS is the "Choose where to create this page"
section of Add Page not showing the correct labels of "Top level" and "Under another page",
but rather "0" and "1" (respectively).

This patch adds a new protected array to the SelectionGroup object to store the labels
of incoming items before they're passed to ToArray(), which will strip them out.

To confirm bug:

1. Install SilverStripe 3.0.3 and login to the administration area
2. Go to Add Page
3. You will see "0" and "1" as labels under "Choose where to create this page" instead of
"Top level" and "Under another page"

To Test:

1. Apply this patch
2. Reload Add Page page with ?flush=all
3. You should now see the correct labels under "Choose where to create this page"
4. Using the radio buttons and actually creating the page should work as before

fixes #8056