+ /**
+ * Return an array of checkbox definitions.
+ *
+ * Array keys correspond to the `<input>` '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 `<input>`
+ * - 'default' (required): default checkedness (true or false)
+ * - 'title-message' (optional): used to generate 'title' attribute for the `<label>`
+ * - 'tooltip' (optional): used to generate 'title' and 'accesskey' attributes
+ * from messages like 'tooltip-foo', 'accesskey-foo'
+ * - 'label-id' (optional): 'id' attribute for the `<label>`
+ * - 'legacy-name' (optional): short name for backwards-compatibility
+ * @param array $checked Array of checkbox name (matching the 'legacy-name') => bool,
+ * where bool indicates the checked status of the checkbox
+ * @return array
+ */
+ protected function getCheckboxesDefinition( $checked ) {
+ global $wgUser;
+ $checkboxes = [];
+
+ // don't show the minor edit checkbox if it's a new page or section
+ if ( !$this->isNew && $wgUser->isAllowed( 'minoredit' ) ) {
+ $checkboxes['wpMinoredit'] = [
+ 'id' => 'wpMinoredit',
+ 'label-message' => 'minoredit',
+ // Uses messages: tooltip-minoredit, accesskey-minoredit
+ 'tooltip' => 'minoredit',
+ 'label-id' => 'mw-editpage-minoredit',
+ 'legacy-name' => 'minor',
+ 'default' => $checked['minor'],
+ ];
+ }
+
+ if ( $wgUser->isLoggedIn() ) {
+ $checkboxes['wpWatchthis'] = [
+ 'id' => 'wpWatchthis',
+ 'label-message' => 'watchthis',
+ // Uses messages: tooltip-watch, accesskey-watch
+ 'tooltip' => 'watch',
+ 'label-id' => 'mw-editpage-watch',
+ 'legacy-name' => 'watch',
+ 'default' => $checked['watch'],
+ ];
+ }
+
+ $editPage = $this;
+ Hooks::run( 'EditPageGetCheckboxesDefinition', [ $editPage, &$checkboxes ] );
+
+ return $checkboxes;
+ }
+