|
WikibaseLexeme
MediaWiki WikibaseLexeme extension
|
Variables | |
| return [ 'PT:wikibase-lexeme'=>['expert-module'=> 'wikibase.experts.Lexeme', 'validator-factory-callback'=> static function() { $factory=WikibaseRepo::getDefaultValidatorBuilders();return $factory->getEntityValidators(Lexeme::ENTITY_TYPE);}, 'formatter-factory-callback'=> static function( $format, FormatterOptions $options) { $snakFormat=new SnakFormat();if( $snakFormat->getBaseFormat( $format)===SnakFormatter::FORMAT_HTML) { $services=MediaWikiServices::getInstance();$options->requireOption(ValueFormatter::OPT_LANG);$userLanguage=$services->getLanguageFactory() ->getLanguage( $options->getOption(ValueFormatter::OPT_LANG));$labelDescriptionLookup=WikibaseRepo::getFallbackLabelDescriptionLookupFactory( $services) ->newLabelDescriptionLookup( $userLanguage);return new EntityIdValueFormatter(new LexemeIdHtmlFormatter(WikibaseRepo::getEntityLookup( $services), $labelDescriptionLookup, WikibaseRepo::getEntityTitleLookup( $services), new MediaWikiLocalizedTextProvider( $userLanguage), new NonExistingEntityIdHtmlFormatter('wikibaselexeme-deletedentity-')));} return WikibaseRepo::getDefaultValueFormatterBuilders() ->newEntityIdFormatter( $format, $options);}, 'value-type'=> 'wikibase-entityid',], 'PT:wikibase-form'=>['expert-module'=> 'wikibase.experts.Form', 'validator-factory-callback'=> static function() { $factory=WikibaseRepo::getDefaultValidatorBuilders();return $factory->getEntityValidators(Form::ENTITY_TYPE);}, 'formatter-factory-callback'=> static function( $format, FormatterOptions $options) { $mwServices=MediaWikiServices::getInstance();$options->requireOption(ValueFormatter::OPT_LANG);$userLanguage=$mwServices->getLanguageFactory() ->getLanguage( $options->getOption(ValueFormatter::OPT_LANG));$revisionLookup=WikibaseRepo::getEntityRevisionLookup( $mwServices);$textProvider=new MediaWikiLocalizedTextProvider( $userLanguage);$snakFormat=new SnakFormat();if( $snakFormat->getBaseFormat( $format)===SnakFormatter::FORMAT_HTML) { $titleLookup=WikibaseRepo::getEntityTitleLookup( $mwServices);$baseFormatter=new FormIdHtmlFormatter($revisionLookup, WikibaseRepo::getFallbackLabelDescriptionLookupFactory( $mwServices) ->newLabelDescriptionLookup( $userLanguage), $titleLookup, $textProvider, new RedirectedLexemeSubEntityIdHtmlFormatter( $titleLookup), $mwServices->getLanguageFactory());} else { $baseFormatter=new FormIdTextFormatter($revisionLookup, $textProvider);} return new EntityIdValueFormatter($baseFormatter);}, 'value-type'=> 'wikibase-entityid',], 'PT:wikibase-sense'=>['expert-module'=> 'wikibase.experts.Sense', 'validator-factory-callback'=> static function() { $factory=WikibaseRepo::getDefaultValidatorBuilders();return $factory->getEntityValidators(Sense::ENTITY_TYPE);}, 'formatter-factory-callback'=> static function( $format, FormatterOptions $options) { $mwServices=MediaWikiServices::getInstance();$revisionLookup=WikibaseRepo::getEntityRevisionLookup( $mwServices);$options->requireOption(ValueFormatter::OPT_LANG);$language=$mwServices->getLanguageFactory() ->getLanguage( $options->getOption(ValueFormatter::OPT_LANG));$localizedTextProvider=new MediaWikiLocalizedTextProvider( $language);$entityIdLabelFormatter=WikibaseRepo::getEntityIdLabelFormatterFactory( $mwServices) ->getEntityIdFormatter( $language);$fallbackchainOption=FormatterLabelDescriptionLookupFactory::OPT_LANGUAGE_FALLBACK_CHAIN;if( $options->hasOption( $fallbackchainOption)) { $fallbackChain=$options->getOption( $fallbackchainOption);} else { $languageFallbackChainFactory=WikibaseRepo::getLanguageFallbackChainFactory( $mwServices);$fallbackChain=$languageFallbackChainFactory->newFromLanguage( $language);} $snakFormat=new SnakFormat();if( $snakFormat->getBaseFormat( $format)===SnakFormatter::FORMAT_HTML) { $titleLookup=WikibaseRepo::getEntityTitleLookup( $mwServices);$languageNameLookup=WikibaseRepo::getLanguageNameLookupFactory( $mwServices) ->getForLanguage( $language);return new EntityIdValueFormatter(new SenseIdHtmlFormatter($titleLookup, $revisionLookup, $localizedTextProvider, $fallbackChain, new LanguageFallbackIndicator( $languageNameLookup), $mwServices->getLanguageFactory(), $entityIdLabelFormatter));} return new EntityIdValueFormatter(new SenseIdTextFormatter($revisionLookup, $localizedTextProvider, $entityIdLabelFormatter));}, 'value-type'=> 'wikibase-entityid',],] | |
| return['PT:wikibase-lexeme'=>[ 'expert-module'=> 'wikibase.experts.Lexeme', 'validator-factory-callback'=> static function() { $factory=WikibaseRepo::getDefaultValidatorBuilders(); return $factory->getEntityValidators(Lexeme::ENTITY_TYPE); }, 'formatter-factory-callback'=> static function($format, FormatterOptions $options) { $snakFormat=new SnakFormat(); if($snakFormat->getBaseFormat($format)===SnakFormatter::FORMAT_HTML) { $services=MediaWikiServices::getInstance(); $options->requireOption(ValueFormatter::OPT_LANG); $userLanguage=$services->getLanguageFactory() ->getLanguage($options->getOption(ValueFormatter::OPT_LANG)); $labelDescriptionLookup=WikibaseRepo::getFallbackLabelDescriptionLookupFactory($services) ->newLabelDescriptionLookup($userLanguage); return new EntityIdValueFormatter( new LexemeIdHtmlFormatter( WikibaseRepo::getEntityLookup($services), $labelDescriptionLookup, WikibaseRepo::getEntityTitleLookup($services), new MediaWikiLocalizedTextProvider($userLanguage), new NonExistingEntityIdHtmlFormatter( 'wikibaselexeme-deletedentity-'))); } return WikibaseRepo::getDefaultValueFormatterBuilders() ->newEntityIdFormatter($format, $options); }, 'value-type'=> 'wikibase-entityid',], 'PT:wikibase-form'=>[ 'expert-module'=> 'wikibase.experts.Form', 'validator-factory-callback'=> static function() { $factory=WikibaseRepo::getDefaultValidatorBuilders(); return $factory->getEntityValidators(Form::ENTITY_TYPE); }, 'formatter-factory-callback'=> static function($format, FormatterOptions $options) { $mwServices=MediaWikiServices::getInstance(); $options->requireOption(ValueFormatter::OPT_LANG); $userLanguage=$mwServices->getLanguageFactory() ->getLanguage($options->getOption(ValueFormatter::OPT_LANG)); $revisionLookup=WikibaseRepo::getEntityRevisionLookup($mwServices); $textProvider=new MediaWikiLocalizedTextProvider($userLanguage); $snakFormat=new SnakFormat(); if($snakFormat->getBaseFormat($format)===SnakFormatter::FORMAT_HTML) { $titleLookup=WikibaseRepo::getEntityTitleLookup($mwServices); $baseFormatter=new FormIdHtmlFormatter( $revisionLookup, WikibaseRepo::getFallbackLabelDescriptionLookupFactory($mwServices) ->newLabelDescriptionLookup($userLanguage), $titleLookup, $textProvider, new RedirectedLexemeSubEntityIdHtmlFormatter($titleLookup), $mwServices->getLanguageFactory()); } else { $baseFormatter=new FormIdTextFormatter( $revisionLookup, $textProvider); } return new EntityIdValueFormatter( $baseFormatter); }, 'value-type'=> 'wikibase-entityid',], 'PT:wikibase-sense'=>[ 'expert-module'=> 'wikibase.experts.Sense', 'validator-factory-callback'=> static function() { $factory=WikibaseRepo::getDefaultValidatorBuilders(); return $factory->getEntityValidators(Sense::ENTITY_TYPE); }, 'formatter-factory-callback'=> static function($format, FormatterOptions $options) { $mwServices=MediaWikiServices::getInstance(); $revisionLookup=WikibaseRepo::getEntityRevisionLookup($mwServices); $options->requireOption(ValueFormatter::OPT_LANG); $language=$mwServices->getLanguageFactory() ->getLanguage($options->getOption(ValueFormatter::OPT_LANG)); $localizedTextProvider=new MediaWikiLocalizedTextProvider($language); $entityIdLabelFormatter=WikibaseRepo::getEntityIdLabelFormatterFactory($mwServices) ->getEntityIdFormatter($language); $fallbackchainOption=FormatterLabelDescriptionLookupFactory::OPT_LANGUAGE_FALLBACK_CHAIN; if($options->hasOption($fallbackchainOption)) { $fallbackChain=$options->getOption($fallbackchainOption); } else { $languageFallbackChainFactory=WikibaseRepo::getLanguageFallbackChainFactory($mwServices); $fallbackChain=$languageFallbackChainFactory->newFromLanguage($language); } $snakFormat=new SnakFormat(); if($snakFormat->getBaseFormat($format)===SnakFormatter::FORMAT_HTML) { $titleLookup=WikibaseRepo::getEntityTitleLookup($mwServices); $languageNameLookup=WikibaseRepo::getLanguageNameLookupFactory($mwServices) ->getForLanguage($language); return new EntityIdValueFormatter( new SenseIdHtmlFormatter( $titleLookup, $revisionLookup, $localizedTextProvider, $fallbackChain, new LanguageFallbackIndicator($languageNameLookup), $mwServices->getLanguageFactory(), $entityIdLabelFormatter)); } return new EntityIdValueFormatter( new SenseIdTextFormatter( $revisionLookup, $localizedTextProvider, $entityIdLabelFormatter)); }, 'value-type'=> 'wikibase-entityid',],] |