Semantic MediaWiki and related extensions
|
Public Member Functions | |
__construct (LocalLanguage $localLanguage) | |
getDataItemId ( $typeId) | |
getDataItemByType ( $typeId) | |
isRegistered ( $typeId) | |
isRecordType (string $typeId) | |
isSubDataType ( $typeId) | |
isBrowsableType ( $typeId) | |
isEqualByType ( $srcType, $tagType) | |
registerDataType ( $id, $className, $dataItemId, $label=false, $isSubDataType=false, $isBrowsableType=false) | |
registerDataTypeAlias ( $typeId, $typeAlias) | |
findTypeId ( $label) | |
findTypeByLabel ( $label) | |
findTypeByLabelAndLanguage ( $label, $languageCode=false) | |
getFieldType ( $type) | |
findTypeLabel ( $id) | |
findCanonicalLabelById ( $id) | |
getCanonicalDatatypeLabels () | |
getKnownTypeLabels () | |
getKnownTypeAliases () | |
getDefaultDataItemTypeId ( $diType) | |
getDefaultDataItemByType ( $typeId) | |
getDataTypeClassById ( $typeId) | |
hasDataTypeClassById ( $typeId) | |
registerCallable ( $typeId, $key, callable $callable) | |
getCallablesByTypeId ( $typeId) | |
clearCallables () | |
Static Public Member Functions | |
static | getInstance () |
static | clear () |
Protected Member Functions | |
initDatatypes (array $typeList) | |
Static Protected Attributes | |
static | $instance = null |
DataTypes registry class
Registry class that manages datatypes, and provides various methods to access the information
GNU GPL v2+
SMW\DataTypeRegistry::__construct | ( | LocalLanguage | $localLanguage | ) |
Lang | $localLanguage |
|
static |
Resets the DataTypeRegistry instance
SMW\DataTypeRegistry::clearCallables | ( | ) |
SMW\DataTypeRegistry::findCanonicalLabelById | ( | $id | ) |
Returns a label for a typeId that is independent from the user/content language
SMW\DataTypeRegistry::findTypeByLabel | ( | $label | ) |
Look up the ID that identifies the datatype of the given label internally. This id is used for all internal operations. If the label does not belong to a known type, the empty string is returned.
string | $label |
SMW\DataTypeRegistry::findTypeByLabelAndLanguage | ( | $label, | |
$languageCode = false |
|||
) |
string | $label | |
string | false | $languageCode |
SMW\DataTypeRegistry::findTypeId | ( | $label | ) |
SMW\DataTypeRegistry::findTypeLabel | ( | $id | ) |
Get the translated user label for a given internal ID. If the ID does not have a label associated with it in the current language, the empty string is returned. This is the case both for internal type ids and for invalid (unknown) type ids, so this method cannot be used to distinguish the two.
string | $id |
SMW\DataTypeRegistry::getCallablesByTypeId | ( | $typeId | ) |
string | $typeId |
SMW\DataTypeRegistry::getCanonicalDatatypeLabels | ( | ) |
SMW\DataTypeRegistry::getDataItemByType | ( | $typeId | ) |
Get the preferred data item ID for a given type. The ID defines the appropriate data item class for processing data of this type. See DataItem for possible values.
$typeId | string id string for the given type |
SMW\DataTypeRegistry::getDataItemId | ( | $typeId | ) |
SMW\DataTypeRegistry::getDataTypeClassById | ( | $typeId | ) |
Returns a class based on a typeId
string | $typeId |
SMW\DataTypeRegistry::getDefaultDataItemByType | ( | $typeId | ) |
Returns a default DataItem for a matchable type ID
string | $diType |
SMW\DataTypeRegistry::getDefaultDataItemTypeId | ( | $diType | ) |
SMW\DataTypeRegistry::getFieldType | ( | $type | ) |
string | $type |
|
static |
SMW\DataTypeRegistry::getKnownTypeAliases | ( | ) |
SMW\DataTypeRegistry::getKnownTypeLabels | ( | ) |
Return an array of all labels that a user might specify as the type of a property, and that are internal (i.e. not user defined). No labels are returned for internal types without user labels (e.g. the special types for some special properties), and for user defined types.
SMW\DataTypeRegistry::hasDataTypeClassById | ( | $typeId | ) |
Whether a datatype class is registered for a particular typeId
string | $typeId |
|
protected |
Gather all available datatypes and label<=>id<=>datatype associations. This method is called before most methods of this factory.
SMW\DataTypeRegistry::isBrowsableType | ( | $typeId | ) |
string | $typeId |
SMW\DataTypeRegistry::isEqualByType | ( | $srcType, | |
$tagType | |||
) |
string | $srcType | |
string | $tagType |
SMW\DataTypeRegistry::isRecordType | ( | string | $typeId | ) |
string | $typeId |
SMW\DataTypeRegistry::isRegistered | ( | $typeId | ) |
string |
SMW\DataTypeRegistry::isSubDataType | ( | $typeId | ) |
string | $typeId |
SMW\DataTypeRegistry::registerCallable | ( | $typeId, | |
$key, | |||
callable | $callable | ||
) |
This function allows for registered types to add additional data or functions required by an individual DataValue of that type.
Register the data: $dataTypeRegistry = DataTypeRegistry::getInstance();
$dataTypeRegistry->registerDataType( '__foo', ... ); $dataTypeRegistry->registerCallable( '__foo', 'my.function', ... ); ...
Access the data: $dataValueFactory = DataValueFactory::getInstance();
$dataValue = $dataValueFactory->newDataValueByType( '__foo' ); $dataValue->getCallable( 'my.function' ) ...
string | $typeId | |
string | $key | |
callable | $callable |
RuntimeException |
SMW\DataTypeRegistry::registerDataType | ( | $id, | |
$className, | |||
$dataItemId, | |||
$label = false , |
|||
$isSubDataType = false , |
|||
$isBrowsableType = false |
|||
) |
A function for registering/overwriting datatypes for SMW. Should be called from within the hook 'smwInitDatatypes'.
$id | string type ID for which this datatype is registered | |
$className | string name of the according subclass of SMWDataValue | |
$dataItemId | integer ID of the data item class that this data value uses, see DataItem | |
$label | mixed string label or false for types that cannot be accessed by users | |
boolean | $isSubDataType | |
boolean | $isBrowsableType |
SMW\DataTypeRegistry::registerDataTypeAlias | ( | $typeId, | |
$typeAlias | |||
) |
Add a new alias label to an existing datatype id. Note that every ID should have a primary label, either provided by SMW or registered with registerDataType(). This function should be called from within the hook 'smwInitDatatypes'.
string | $typeId | |
string | $typeAlias |