Change page handle?
Got what I hope is a simple question. I'm trying to set up a form that changes the name, and subsequently handle, of a page. Following the docs, I wrote this code (assume I've already validated that $handle is unique among all pages):
$handle = strtolower($name);
$handle = str_replace(array("\n","\t","\r"," ","-"),"_",$handle);
$projectPage = Page::getByID($project["page_id"]);
$update = array(
"cName" => $name,
"cHandle" => $handle
This successfully changes the page name, but the handle remains unaffected - which leads me to believe I've either got the cHandle key wrong, or I've mistyped something. Any insight?
Thanks in advance!
For some reason, the page's $page->getCollectionHandle(); is returning the updated handle. The real problem seems to be that the page's canonical URL slug isn't updating with the new handle. This doesn't make sense to me - a quick peek at the source reveals that the canonical url's fieldname is cHandle, so it follows that the two would be one in the same.
Is the canonical URL a separate attribute that I can/should be updating, or is this a failsafe? perhaps even a bug?
Any insight is appreciated. Thanks!
The Documentation and API naming is so stupid that Liferays API looks much better then Concrete5s. Liferays api is awful.
Hugh thanks for quick replay. I have tried it on 5.4.2 what was updated from 5.4.1. So no solution for this. It's looks like that is a bug. I will do an bug report for this.
I think you need a $projectPage->rescanCollectionPath(); to the cHandle updated.