Semantic MediaWiki and related extensions
register

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.

Type registration

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:

return array(
    // ...
    FooValue::TYPE_ID => [ FooValue::class, DataItem::TYPE_WIKIPAGE, false, false ],
);
class FooValue extends DataValue {
    /**
     * DV identifier
     */
    const TYPE_ID = '_foo';
    /**
     * 
See also
DataValue::parseUserValue * *
Parameters
string$value*/ protected function parseUserValue( $userValue ) { ... }
}

Label registration

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"
            ...
        }
    },

About | General disclaimer | Privacy policy