Semantic MediaWiki and related extensions
|
The following example demonstrates how to register a new https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/docs/architecture/datamodel.datatype.md "`DataType`" and https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/docs/architecture/datamodel.datavalue.md "`DataValue`" in Semantic MediaWiki.
All IDs must start with an underscore, two underscores indicate a truly internal (non user-interacted type), three underscores should be used by an extension.
TypesRegistry::getDataTypeList
expects that the following information are provided:
FooValue::TYPE_ID
)return array( // ... FooValue::TYPE_ID => [ FooValue::class, DataItem::TYPE_WIKIPAGE, false, false ], );
class FooValue extends DataValue {
/** * DV identifier */ const TYPE_ID = '_foo';
/** *
string | $value | */ protected function parseUserValue( $userValue ) { ... } |
By default, DataTypes (Date, URL etc.) are registered with a corresponding property of the same name to match the expected semantics. For an exemption, see smwgDataTypePropertyExemptionList
.
Find i18n/extra/en.json
and extend the canonical description (which is English) with something like:
"datatype":{ "labels": { "_foo": "SomeType" ... } "aliases": { "SomeType": "_foo" "ExtraAlias": "_foo" ... } },