Hi everybody!
I just noticed that it's not possible to save changes made with Pagemanager from current trunk. The problem is, that XH_PageDataRouter::$model is protected since r1490, but Pagemanager calls $pd_router->model->refresh(). Unfortunately, there's no equivalent method available in XH_PageDataRouter, and passing modified page data page-wise would trigger saving of content.htm for each page.
As a quick fix (in the long run we have to consider to rework the whole page data stuff) I suggest to add a public method refresh() to XH_PageDataRouter which simply delegates to XH_PageDataModel::refresh().
Also note, that protecting XH_PageDataRouter::$model might have broken other extensions as well, even though I presume, that it's not used by other extensions.
Thoughs?
XH 1.7: Add public XH_PageDataRouter::refresh()
XH 1.7: Add public XH_PageDataRouter::refresh()
Last edited by cmb on Wed Mar 25, 2015 10:07 pm, edited 1 time in total.
Reason: changed Subject to clarify suggestion
Reason: changed Subject to clarify suggestion
Christoph M. Becker – Plugins for CMSimple_XH
Re: XH 1.7: Add public XH_PageDataRouter::refresh()
Hi everybody!
I propose this patch:
The patch doesn't fix Pagemanager, but I shall make a new version of Pagemanager available within the next weeks.
I propose this patch:
Code: Select all
Index: cmsimple/classes/PageDataRouter.php
===================================================================
--- cmsimple/classes/PageDataRouter.php (revision 1529)
+++ cmsimple/classes/PageDataRouter.php (working copy)
@@ -142,6 +142,18 @@
}
/**
+ * Replaces the existing page data.
+ *
+ * @param array $data The new page data.
+ *
+ * @return bool Whether the page data have been refreshed.
+ */
+ public function refresh(array $data = null)
+ {
+ return $this->model->refresh($data);
+ }
+
+ /**
* Returns the page data of a single page.
*
* @param int $id The page index.
Christoph M. Becker – Plugins for CMSimple_XH
Re: XH 1.7: Add public XH_PageDataRouter::refresh()
Done (r1542).
Christoph M. Becker – Plugins for CMSimple_XH
Re: XH 1.7: Add public XH_PageDataRouter::refresh()
Pagemanager_XH 3.0dev1 is now integrated into the trunk.cmb wrote:The patch doesn't fix Pagemanager, but I shall make a new version of Pagemanager available within the next weeks.
Christoph M. Becker – Plugins for CMSimple_XH