In System->Configuration->Web->Default Pages
I can set the default homepage and others.
I can even set different homepages on different store views. So far so good. That's very useful.
But here is what I don't understand.
The dropdown that allows me to select the pages looks like this: (generated by Mage_Cms_Model_Resource_Page_Collection::toOptionIdArray
).
<select class=" select" name="groups[default][fields][cms_home_page][value]" id="web_default_cms_home_page">
<option value="no-route">404 Not Found 1</option>
<option value="home">Home page</option>
<option value="home|5">Home page</option>
...
</select>
As you can see, when I hage 2 pages with the same identifier (home
) the second one has the value identifier|page_id
. The rest just use the identifier.
Now on the frontend, when the homepage should be rendered, the config value is read and passed to the Mage_Cms_Helper_Page::_renderPage
method, that renders the page.
But in the method mentioned above this is how the page is determined:
if (!is_null($pageId) && $pageId!==$page->getId()) {
$delimeterPosition = strrpos($pageId, '|');
if ($delimeterPosition) {
$pageId = substr($pageId, 0, $delimeterPosition);
}
$page->setStoreId(Mage::app()->getStore()->getId());
if (!$page->load($pageId)) {
return false;
}
}
So the id after |
is never used.
Is there any advantage of generating the options like this identifier|page_id
that I'm missing?
It seams to me that it would have worked fine with only the page identifier or just the page id as option values.
toOptionIdArray
method, just generates and array.