* …
=== Action API changes in 1.33 ===
+* (T198913) Added 'ApiOptions' hook.
* …
=== Action API internal changes in 1.33 ===
(url), 'width', 'height', 'alt', 'align'.
- url: Url for the given title.
+'ApiOptions': Called by action=options before applying changes to user
+preferences.
+$apiModule: Calling ApiOptions object
+$user: User object whose preferences are being changed
+$changes: Associative array of preference name => value
+$resetKinds: Array of strings specifying which options kinds to reset.
+ See User::resetOptions() and User::getOptionKinds() for possible
+ values.
+
'ApiParseMakeOutputPage': Called when preparing the OutputPage object for
ApiParse. This is mainly intended for calling OutputPage::addContentOverride()
or OutputPage::addContentOverrideCallback().
$this->dieWithError( [ 'apierror-missingparam', 'optionname' ] );
}
- if ( $params['reset'] ) {
- $this->resetPreferences( $params['resetkinds'] );
- $changed = true;
+ $resetKinds = $params['resetkinds'];
+ if ( !$params['reset'] ) {
+ $resetKinds = [];
}
$changes = [];
$newValue = $params['optionvalue'] ?? null;
$changes[$params['optionname']] = $newValue;
}
+
+ Hooks::run( 'ApiOptions', [ $this, $user, $changes, $resetKinds ] );
+
+ if ( $resetKinds ) {
+ $this->resetPreferences( $resetKinds );
+ $changed = true;
+ }
+
if ( !$changed && !count( $changes ) ) {
$this->dieWithError( 'apierror-nochanges' );
}
"prefixindex-namespace": "All pages with prefix ($1 namespace)",
"prefixindex-summary": "",
"prefixindex-submit": "Show",
- "prefixindex-strip": "Strip prefix in list",
+ "prefixindex-strip": "Hide the prefix in results",
"shortpages": "Short pages",
"shortpages-summary": "",
"longpages": "Long pages",