MediaWiki master
ApiQueryCodexIcons.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Api;
4
7
9
10 public function execute() {
11 $params = $this->extractRequestParams();
12 $iconNames = $params['names'];
13
14 $icons = CodexModule::getIcons( null, $this->getConfig(), $iconNames );
15
16 $result = $this->getResult();
17 $result->addValue( 'query', $this->getModuleName(), $icons );
18 }
19
21 public function getCacheMode( $params ) {
22 return 'public';
23 }
24
29 public function shouldCheckMaxlag() {
30 return false;
31 }
32
34 public function getAllowedParams() {
35 return [
36 'names' => [
37 ParamValidator::PARAM_TYPE => array_keys( CodexModule::getIcons( null, $this->getConfig() ) ),
38 ParamValidator::PARAM_REQUIRED => true,
39 ParamValidator::PARAM_ISMULTI => true,
40 ParamValidator::PARAM_ALL => true,
41 ]
42 ];
43 }
44
46 protected function getExamplesMessages() {
47 return [
48 'action=query&list=codexicons&names=cdxIconInfo|cdxIconTrash' =>
49 'apihelp-query+codexicons-example',
50 ];
51 }
52
54 public function getHelpUrls() {
55 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:CodexIcons';
56 }
57}
getModuleName()
Get the name of the module being executed by this instance.
Definition ApiBase.php:543
getResult()
Get the result object.
Definition ApiBase.php:682
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
Definition ApiBase.php:823
This is a base class for all Query modules.
getHelpUrls()
Return links to more detailed help pages about the module.1.25, returning boolean false is deprecated...
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
shouldCheckMaxlag()
No database interaction, so maxlag check is irrelevant.
getExamplesMessages()
Returns usage examples for this module.Return value has query strings as keys, with values being eith...
getCacheMode( $params)
Get the cache mode for the data generated by this module.Override this in the module subclass....
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
Module for codex that has direction-specific style files and a static helper function for embedding i...
static getIcons(?Context $context, Config $config, ?array $iconNames=null)
Retrieve the specified icon definitions from codex-icons.json.
Service for formatting and validating API parameters.