LogEventsListGetExtraInputs: Keep $input and add $formDescriptor
Follows-up on Iba3c6aa5ac40dcdee0792c2d045b238b02d76521. Bug: T117737 Bug: T199495 Change-Id: I697e158887fcca1da88763a4c929a981d9211490
This commit is contained in:
parent
dbb952a579
commit
52c62c65cd
3 changed files with 29 additions and 6 deletions
|
|
@ -186,8 +186,6 @@ because of Phabricator reports.
|
|||
CapsuleMultiselectWidget. The following methods may no longer be used:
|
||||
* setItemsFromData: Use setValue instead
|
||||
* getItemsData: Use getItems instead and get the data property
|
||||
* The hook 'LogEventsListGetExtraInputs' now needs a form descriptor array
|
||||
and not plain HTML.
|
||||
* LanguageCode::bcp47() now always returns a valid BCP 47 code. This means
|
||||
that some MediaWiki-specific language codes, such as `simple`, are mapped
|
||||
into valid BCP 47 codes (eg `en-simple`).
|
||||
|
|
@ -261,6 +259,8 @@ because of Phabricator reports.
|
|||
* (T100681) Use of the Parsoid v1 API with the VirtualRESTService, deprecated in
|
||||
MediaWiki 1.26, is now hard-deprecated. All known clients were converted to
|
||||
the Parsoid v3 API in May 2015.
|
||||
* $input is deprecated in hook 'LogEventsListGetExtraInputs'. Use
|
||||
$formDescriptor instead.
|
||||
|
||||
=== Other changes in 1.32 ===
|
||||
* (T198811) The following tables have had their UNIQUE indexes turned into
|
||||
|
|
|
|||
|
|
@ -2187,6 +2187,7 @@ $autocreated: Boolean, whether this was an auto-creation
|
|||
Special:Log for a specific log type
|
||||
$type: String of log type being displayed
|
||||
$logEventsList: LogEventsList object for context and access to the WebRequest
|
||||
&$input: string HTML of an input element (deprecated, use $formDescriptor instead)
|
||||
&$formDescriptor: array HTMLForm's form descriptor
|
||||
|
||||
'LogEventsListShowLogExtract': Called before the string is added to OutputPage.
|
||||
|
|
|
|||
|
|
@ -123,9 +123,19 @@ class LogEventsList extends ContextSource {
|
|||
$formDescriptor['page'] = $this->getTitleInputDesc( $title );
|
||||
|
||||
// Add extra inputs if any
|
||||
// This could either be a form descriptor array or a string with raw HTML.
|
||||
// We need it to work in both cases and show a deprecation warning if it
|
||||
// is a string. See T199495.
|
||||
$extraInputsDescriptor = $this->getExtraInputsDesc( $types );
|
||||
if ( !empty( $extraInputsDescriptor ) ) {
|
||||
if (
|
||||
is_array( $extraInputsDescriptor ) &&
|
||||
!empty( $extraInputsDescriptor )
|
||||
) {
|
||||
$formDescriptor[ 'extra' ] = $extraInputsDescriptor;
|
||||
} elseif ( is_string( $extraInputsDescriptor ) ) {
|
||||
// We'll add this to the footer of the form later
|
||||
$extraInputsString = $extraInputsDescriptor;
|
||||
wfDeprecated( 'Using $input in LogEventsListGetExtraInputs hook', '1.32' );
|
||||
}
|
||||
|
||||
// Title pattern, if allowed
|
||||
|
|
@ -165,6 +175,15 @@ class LogEventsList extends ContextSource {
|
|||
->setSubmitText( $this->msg( 'logeventslist-submit' )->text() )
|
||||
->setWrapperLegendMsg( 'log' );
|
||||
|
||||
// TODO This will should be removed at some point. See T199495.
|
||||
if ( isset( $extraInputsString ) ) {
|
||||
$htmlForm->addFooterText( Html::rawElement(
|
||||
'div',
|
||||
null,
|
||||
$extraInputsString
|
||||
) );
|
||||
}
|
||||
|
||||
$htmlForm->prepareForm()->displayForm( false );
|
||||
}
|
||||
|
||||
|
|
@ -279,7 +298,7 @@ class LogEventsList extends ContextSource {
|
|||
|
||||
/**
|
||||
* @param array $types
|
||||
* @return array Form descriptor
|
||||
* @return array|string Form descriptor or string with HTML
|
||||
*/
|
||||
private function getExtraInputsDesc( $types ) {
|
||||
if ( count( $types ) == 1 ) {
|
||||
|
|
@ -297,9 +316,12 @@ class LogEventsList extends ContextSource {
|
|||
];
|
||||
} else {
|
||||
// Allow extensions to add their own extra inputs
|
||||
// This could be an array or string. See T199495.
|
||||
$input = ''; // Deprecated
|
||||
$formDescriptor = [];
|
||||
Hooks::run( 'LogEventsListGetExtraInputs', [ $types[0], $this, &$formDescriptor ] );
|
||||
return $formDescriptor;
|
||||
Hooks::run( 'LogEventsListGetExtraInputs', [ $types[0], $this, &$input, &$formDescriptor ] );
|
||||
|
||||
return empty( $formDescriptor ) ? $input : $formDescriptor;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue