From: jenkins-bot Date: Wed, 29 Mar 2017 20:39:07 +0000 (+0000) Subject: Merge "EditPage: Refactor getCheckboxes() to allow changing the format" X-Git-Tag: 1.31.0-rc.0~3667 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=f6432ba07cf71ae75254c1c0c13d01c05dd30518;hp=a15b20ad8fb354313d2c2b7cfa3e88f69f4c2f94;p=lhc%2Fweb%2Fwiklou.git Merge "EditPage: Refactor getCheckboxes() to allow changing the format" --- diff --git a/RELEASE-NOTES-1.29 b/RELEASE-NOTES-1.29 index ab7537528e..793769ff1c 100644 --- a/RELEASE-NOTES-1.29 +++ b/RELEASE-NOTES-1.29 @@ -272,6 +272,10 @@ changes to languages because of Phabricator reports. * Article::getLastPurgeTimestamp(), WikiPage::getLastPurgeTimestamp(), and the WikiPage::PURGE_* constants are deprecated, and the functions will always return false. They were a hack for an issue that has since been fixed. +* Hook 'EditPageBeforeEditChecks' is now deprecated. Instead use the new hook + 'EditPageGetCheckboxesDefinition', or 'EditPage::showStandardInputs:options' + if you don't actually care about checkboxes and just want to add some HTML + to the page. == Compatibility == diff --git a/docs/hooks.txt b/docs/hooks.txt index 3a57563f33..a38f9bb526 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1404,10 +1404,12 @@ textarea in the edit form. &$buttons: Array of edit buttons "Save", "Preview", "Live", and "Diff" &$tabindex: HTML tabindex of the last edit check/button -'EditPageBeforeEditChecks': Allows modifying the edit checks below the textarea -in the edit form. +'EditPageBeforeEditChecks': DEPRECATED! Use 'EditPageGetCheckboxesDefinition' instead, +or 'EditPage::showStandardInputs:options' if you don't actually care about checkboxes +and just want to add some HTML to the page. +Allows modifying the edit checks below the textarea in the edit form. &$editpage: The current EditPage object -&$checks: Array of edit checks like "watch this page"/"minor edit" +&$checks: Array of the HTML for edit checks like "watch this page"/"minor edit" &$tabindex: HTML tabindex of the last edit check/button 'EditPageBeforeEditToolbar': Allows modifying the edit toolbar above the @@ -1420,6 +1422,12 @@ $title: title of page being edited &$msg: localization message name, overridable. Default is either 'copyrightwarning' or 'copyrightwarning2'. +'EditPageGetCheckboxesDefinition': Allows modifying the edit checkboxes +below the textarea in the edit form. +$editpage: The current EditPage object +&$checkboxes: Array of checkbox definitions. See EditPage::getCheckboxesDefinition() +for the format. + 'EditPageGetDiffContent': Allow modifying the wikitext that will be used in "Show changes". Note that it is preferable to implement diff handling for different data types using the ContentHandler facility. diff --git a/includes/EditPage.php b/includes/EditPage.php index ac62e3fc70..7d19e94ad7 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -4005,70 +4005,114 @@ HTML return $toolbar; } + /** + * Return an array of checkbox definitions. + * + * Array keys correspond to the `` 'name' attribute to use for each checkbox. + * + * Array values are associative arrays with the following keys: + * - 'label-message' (required): message for label text + * - 'id' (required): 'id' attribute for the `` + * - 'default' (required): default checkedness (true or false) + * - 'title-message' (optional): used to generate 'title' attribute for the `