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
20 public function getCacheMode( $params ) {
21 return 'public';
22 }
23
28 public function shouldCheckMaxlag() {
29 return false;
30 }
31
32 public function getAllowedParams() {
33 return [
34 'names' => [
35 ParamValidator::PARAM_TYPE => 'string',
36 ParamValidator::PARAM_REQUIRED => true,
37 ParamValidator::PARAM_ISMULTI => true,
38 ]
39 ];
40 }
41
42 protected function getExamplesMessages() {
43 return [
44 'action=query&list=codexicons&names=cdxIconInfo|cdxIconTrash' =>
45 'apihelp-query+codexicons-example',
46 ];
47 }
48
49 public function getHelpUrls() {
50 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:CodexIcons';
51 }
52}
getModuleName()
Get the name of the module being executed by this instance.
Definition ApiBase.php:557
getResult()
Get the result object.
Definition ApiBase.php:696
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
Definition ApiBase.php:837
This is a base class for all Query modules.
getHelpUrls()
Return links to more detailed help pages about the module.
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.
getCacheMode( $params)
Get the cache mode for the data generated by this module.
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=[])
Retrieve the specified icon definitions from codex-icons.json.
Service for formatting and validating API parameters.