/** @var FormOptions */
protected $rcOptions;
- /** @var array */
- protected $customFilters;
-
// Order of both groups and filters is significant; first is top-most priority,
// descending from there.
// 'showHideSuffix' is a shortcut to and avoid spelling out
*
* Groups are displayed to the user in the structured UI. However, if necessary,
* all of the filters in a group can be configured to only display on the
- * unstuctured UI, in which case you don't need a group title. This is done in
- * getFilterGroupDefinitionFromLegacyCustomFilters, for example.
+ * unstuctured UI, in which case you don't need a group title.
*
* @var array $filterGroupDefinitions
*/
$out = $this->getOutput();
if ( $this->isStructuredFilterUiEnabled() && !$this->including() ) {
$jsData = $this->getStructuredFilterJsData();
-
$messages = [];
foreach ( $jsData['messageKeys'] as $key ) {
$messages[$key] = $this->msg( $key )->plain();
}
- $out->addBodyClasses( 'mw-rcfilters-enabled' );
+ $out->addBodyClasses( 'mw-rcfilters-enabled' );
$collapsed = $this->getUser()->getBoolOption( static::$collapsedPreferenceName );
if ( $collapsed ) {
$out->addBodyClasses( 'mw-rcfilters-collapsed' );
}
- $out->addHTML(
- ResourceLoader::makeInlineScript(
- ResourceLoader::makeMessageSetScript( $messages ),
- $out->getCSPNonce()
- )
- );
-
+ // These config and message exports should be moved into a ResourceLoader data module (T201574)
$out->addJsConfigVars( 'wgStructuredChangeFilters', $jsData['groups'] );
+ $out->addJsConfigVars( 'wgStructuredChangeFiltersMessages', $messages );
$out->addJsConfigVars( 'wgStructuredChangeFiltersCollapsedState', $collapsed );
$out->addJsConfigVars(
Hooks::run( 'ChangesListSpecialPageStructuredFilters', [ $this ] );
- $unstructuredGroupDefinition =
- $this->getFilterGroupDefinitionFromLegacyCustomFilters(
- $this->getCustomFilters()
- );
- $this->registerFiltersFromDefinitions( [ $unstructuredGroupDefinition ] );
+ $this->registerFiltersFromDefinitions( [] );
$userExperienceLevel = $this->getFilterGroup( 'userExpLevel' );
$registered = $userExperienceLevel->getFilter( 'registered' );
}
}
- /**
- * Get filter group definition from legacy custom filters
- *
- * @param array $customFilters Custom filters from legacy hooks
- * @return array Group definition
- */
- protected function getFilterGroupDefinitionFromLegacyCustomFilters( array $customFilters ) {
- // Special internal unstructured group
- $unstructuredGroupDefinition = [
- 'name' => 'unstructured',
- 'class' => ChangesListBooleanFilterGroup::class,
- 'priority' => -1, // Won't display in structured
- 'filters' => [],
- ];
-
- foreach ( $customFilters as $name => $params ) {
- $unstructuredGroupDefinition['filters'][] = [
- 'name' => $name,
- 'showHide' => $params['msg'],
- 'default' => $params['default'],
- ];
- }
-
- return $unstructuredGroupDefinition;
- }
-
/**
* @return array The legacy show/hide toggle filters
*/
return $output;
}
- /**
- * Get custom show/hide filters using deprecated ChangesListSpecialPageFilters
- * hook.
- *
- * @return array Map of filter URL param names to properties (msg/default)
- */
- protected function getCustomFilters() {
- if ( $this->customFilters === null ) {
- $this->customFilters = [];
- Hooks::run( 'ChangesListSpecialPageFilters', [ $this, &$this->customFilters ], '1.29' );
- }
-
- return $this->customFilters;
- }
-
/**
* Fetch values for a FormOptions object from the WebRequest associated with this instance.
*