Skip to content

Commit

Permalink
refactor: Incorporate MW 1.38 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
octfx committed May 28, 2022
1 parent e516a91 commit 2f0a657
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
33 changes: 17 additions & 16 deletions includes/ApiEmbedVideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace MediaWiki\Extension\EmbedVideo;

use ApiBase;
use Wikimedia\ParamValidator\ParamValidator;

class ApiEmbedVideo extends ApiBase {
/**
Expand Down Expand Up @@ -53,36 +54,36 @@ public function execute(): bool {
public function getAllowedParams(): array {
return array_merge( parent::getAllowedParams(), [
'service' => [
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => true
ParamValidator::PARAM_TYPE => 'string',
ParamValidator::PARAM_REQUIRED => true
],
'id' => [
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => true
ParamValidator::PARAM_TYPE => 'string',
ParamValidator::PARAM_REQUIRED => true
],
'dimensions' => [
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => false
ParamValidator::PARAM_TYPE => 'string',
ParamValidator::PARAM_REQUIRED => false
],
'alignment' => [
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => false
ParamValidator::PARAM_TYPE => 'string',
ParamValidator::PARAM_REQUIRED => false
],
'description' => [
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => false
ParamValidator::PARAM_TYPE => 'string',
ParamValidator::PARAM_REQUIRED => false
],
'container' => [
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => false
ParamValidator::PARAM_TYPE => 'string',
ParamValidator::PARAM_REQUIRED => false
],
'urlargs' => [
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => false
ParamValidator::PARAM_TYPE => 'string',
ParamValidator::PARAM_REQUIRED => false
],
'autoresize' => [
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => false
ParamValidator::PARAM_TYPE => 'string',
ParamValidator::PARAM_REQUIRED => false
],
] );
}
Expand Down
10 changes: 4 additions & 6 deletions includes/EmbedVideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ public static function parseEV( Parser $parser, PPFrame $frame, array $args, boo
}
}

$embedVideo = new EmbedVideo( $parser, $expandedArgs, $fromTag );

return $embedVideo->output();
return ( new EmbedVideo( $parser, $expandedArgs, $fromTag ) )->output();
}

/**
Expand Down Expand Up @@ -496,11 +494,11 @@ private function addModules(): void {
}
}

$out->addModules( 'ext.embedVideo' );
$out->addModuleStyles( 'ext.embedVideo.styles' );
$out->addModules( [ 'ext.embedVideo' ] );
$out->addModuleStyles( [ 'ext.embedVideo.styles' ] );

if ( MediaWikiServices::getInstance()->getMainConfig()->get( 'EmbedVideoRequireConsent' ) === true ) {
$out->addModules( 'ext.embedVideo.consent' );
$out->addModules( [ 'ext.embedVideo.consent' ] );
}
}
}

0 comments on commit 2f0a657

Please sign in to comment.