jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/328485 )
Change subject: Hygiene: Tidy SpecialMobileOptions module listing
......................................................................
Hygiene: Tidy SpecialMobileOptions module listing
Generating a list of modules that should be added to the output is its
own small slice of responsibility. Formalize this by moving it into a
private method.
Changes:
* SpecialMobileOptions#getSettingsForm -> #addSettingsForm as it's not a
getter - it adds the rendered settings form to the output.
* Add SpecialMobileOptions#getModules to get the list of modules that
should be added to the output and make #addSettingsForm defer to it.
Bug: T148193
Change-Id: Icf664d4512c9e65f89d8572b5cebf1a0c7551593
---
M includes/specials/SpecialMobileOptions.php
1 file changed, 25 insertions(+), 7 deletions(-)
Approvals:
Pmiazga: Looks good to me, but someone else must approve
Bmansurov: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/specials/SpecialMobileOptions.php
b/includes/specials/SpecialMobileOptions.php
index 40e781a..7d91ecb 100644
--- a/includes/specials/SpecialMobileOptions.php
+++ b/includes/specials/SpecialMobileOptions.php
@@ -63,18 +63,31 @@
if ( $this->getRequest()->wasPosted() ) {
$this->submitSettingsForm();
} else {
- if ( $context->getConfigVariable(
'MinervaEnableFontChanger' ) ) {
- $this->getOutput()->addModules(
'mobile.special.mobileoptions.scripts.fontchanger' );
- }
- $this->getSettingsForm();
+ $this->addSettingsForm();
}
}
}
/**
- * Render the settings form (with actual set settings) to display to
user
+ * Gets the Resource Loader modules that should be added to the output.
+ *
+ * @return string[]
*/
- private function getSettingsForm() {
+ private function getModules( MobileContext $context ) {
+ $result = [];
+
+ if ( $context->getConfigVariable( 'MinervaEnableFontChanger' )
) {
+ $result[] =
'mobile.special.mobileoptions.scripts.fontchanger';
+ }
+
+ return $result;
+ }
+
+ /**
+ * Render the settings form (with actual set settings) and add it to the
+ * output as well as any supporting modules.
+ */
+ private function addSettingsForm() {
$out = $this->getOutput();
$context = MobileContext::singleton();
$user = $this->getUser();
@@ -153,6 +166,11 @@
HTML;
// @codingStandardsIgnoreEnd
$out->addHTML( $html );
+
+ $modules = $this->getModules( $context );
+
+ $this->getOutput()
+ ->addModules( $modules );
}
/**
@@ -234,7 +252,7 @@
$schemaData['action'] = 'error';
$schemaData['errorText'] = $errorText;
ExtMobileFrontend::eventLog( $schema, $schemaRevision,
$schemaData );
- $this->getSettingsForm();
+ $this->addSettingsForm();
return;
}
wfIncrStats( 'mobile.options.saves' );
--
To view, visit https://gerrit.wikimedia.org/r/328485
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Icf664d4512c9e65f89d8572b5cebf1a0c7551593
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Phuedx <[email protected]>
Gerrit-Reviewer: Bmansurov <[email protected]>
Gerrit-Reviewer: Pmiazga <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits