Before: `civicrm/mailing/unsubscribe` points directly to `CRM_Mailing_Form_Unsubscribe`
After: `civicrm/mailing/unsubscribe` points to `CRM_Mailing_Page_Unsubscribe`, which MAY delegate
to `CRM_Mailing_Form_Unsubscribe`
Comments:
* This is a step toward supporting one-click subscribe.
* The problem is that one-click unsubscribe MUST receive a POST on the same URL
as a user-visible form.
* In Quickform (esp `CRM_Mailing_Form_Unsubscribe`), every POST MUST give a `qfKey`.
* We need a place to process the one-click POST *without* requiring `qfKey`.
* There is a pre-existing class `CRM_Mailing_Page_Unsubscribe`. This was dead code.
The patch co-opts/re-uses the class for its own purpose.
* The old `Page` class was not referenced anywhere (by routes or other classes).
* What appears to have happened: this screen was originally a `Page`; then it was
renamed/converted to a `Form`; then shortly after, the original `Page` was re-imported
verbatim by a gsoc student. Their commit doesn't appear to make substantive use of
the `Page`. This smells like mistake in handling branches/merges/rebases.
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
-class CRM_Mailing_Page_Unsubscribe extends CRM_Mailing_Page_Common {
+class CRM_Mailing_Page_Unsubscribe extends CRM_Core_Page {
/**
* Run page.
* @throws Exception
*/
public function run() {
- $this->_type = 'unsubscribe';
- return parent::run();
+ $wrapper = new CRM_Utils_Wrapper();
+ return $wrapper->run('CRM_Mailing_Form_Unsubscribe', $this->_title);
}
}
<item>
<path>civicrm/mailing/unsubscribe</path>
<title>Unsubscribe</title>
- <page_callback>CRM_Mailing_Form_Unsubscribe</page_callback>
+ <page_callback>CRM_Mailing_Page_Unsubscribe</page_callback>
<access_arguments>access CiviMail subscribe/unsubscribe pages</access_arguments>
<is_public>true</is_public>
<weight>640</weight>