Page MenuHomePhabricator

Document configurability of namespace presets
Closed, ResolvedPublic

Description

Follow-up for T173736 & T173734

AC

  • documentation contains explanations of AdvancedSearchNamespacePresets and how to use/override it (provider, namespaces)

Event Timeline

Restricted Application added a project: TCB-Team. · View Herald TranscriptFeb 28 2018, 3:04 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Pablo-WMDE moved this task from Todo to Doing on the WMDE-Fundraising-Sprint-18 board.
Pablo-WMDE added a comment.EditedFeb 28 2018, 5:32 PM

Put the following into docs/settings.md:

Namespace presets

AdvancedSearch supports namespace presets, groups of namespaces that are offered for batch selection via dedicated checkboxes. By default three presets are offered - discussion, generalHelp, and all.

Which namespaces are contained in a preset can be configured

  • statically, through the namespaces key containing an array of namespace ids,
  • or programmatically through the provider key containing a reference to a JavaScript function returning the aforementioned namespace id array. The available provider functions are implemented in NamespacePresetProviders.

You can use $wgAdvancedSearchNamespacePresets to modify the default configuration or add your own presets.

Add a namespace preset

// in your LocalSettings.php
wfLoadExtension( 'AdvancedSearch' );
$wgAdvancedSearchNamespacePresets = [
	'my-custom-preset' => [
		'enabled': true, // indication that this preset should be shown to the user
		'namespaces' => [ '1', '11' ], // list of namespaces to include in this preset
		'label' => 'my-custom-preset-label-id' // id of the translation to use to label the preset checkbox
	]
];

Disable a default namespace preset

// in your LocalSettings.php
wfLoadExtension( 'AdvancedSearch' );
$wgAdvancedSearchNamespacePresets = [
	'generalHelp' => [
		'enabled' => false
	]
];

Change 415349 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/AdvancedSearch@master] extension.json: bump manifest version

https://gerrit.wikimedia.org/r/415349

Change 415541 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/AdvancedSearch@master] [WIP] namespace presets: make configurable

https://gerrit.wikimedia.org/r/415541

Change 415349 merged by jenkins-bot:
[mediawiki/extensions/AdvancedSearch@master] extension.json: bump manifest version

https://gerrit.wikimedia.org/r/415349

Pablo-WMDE added a comment.EditedMar 1 2018, 11:35 AM

Add a section to https://www.mediawiki.org/wiki/Extension:AdvancedSearch

Configuration

The configuration options of AdvancedSearch are documented in the file {{git file|project=mediawiki/extensions/AdvancedSearch|branch=HEAD|file=docs/settings.md|text=docs/settings.md}}.

-> https://www.mediawiki.org/w/index.php?title=Extension%3AAdvancedSearch&type=revision&diff=2728205&oldid=2715316

Pablo-WMDE removed Pablo-WMDE as the assignee of this task.Mar 1 2018, 11:42 AM
Pablo-WMDE moved this task from Doing to Review on the WMDE-Fundraising-Sprint-18 board.

Change 415541 merged by jenkins-bot:
[mediawiki/extensions/AdvancedSearch@master] namespace presets: make configurable

https://gerrit.wikimedia.org/r/415541

Lea_WMDE closed this task as Resolved.Mar 7 2018, 1:33 PM
Lea_WMDE claimed this task.