Semantic MediaWiki and related extensions
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
SMW\PropertyRegistry Class Reference

Public Member Functions

 __construct (DataTypeRegistry $datatypeRegistry, PropertyLabelFinder $propertyLabelFinder, PropertyAliasFinder $propertyAliasFinder, array $dataTypePropertyExemptionList=[])
 
 getPropertyList ()
 
 getKnownPropertyAliases ()
 
 registerProperty ( $id, $valueType, $label=false, $isVisible=false, $isAnnotable=true)
 
 registerPropertyAlias ( $id, $label)
 
 registerPropertyAliasByMsgKey ( $id, $msgKey)
 
 registerPropertyDescriptionByMsgKey ( $id, $msgKey)
 
 registerPropertyDescriptionMsgKeyById ( $id, $msgKey)
 
 findPropertyDescriptionMsgKeyById ( $id)
 
 findPropertyLabelById ( $id)
 
 findCanonicalPropertyLabelById ( $id)
 
 findPropertyLabelFromIdByLanguageCode ( $id, $languageCode='')
 
 findPropertyLabel ( $id)
 
 getPropertyValueTypeById ( $id)
 
 getPropertyTypeId ( $id)
 
 getPredefinedPropertyTypeId ( $id)
 
 findPropertyIdByLabel ( $label, $useAlias=true)
 
 findPropertyIdFromLabelByLanguageCode ( $label, $languageCode='')
 
 findPreferredPropertyLabelFromIdByLanguageCode ( $id, $languageCode='')
 
 findPropertyId ( $label, $useAlias=true)
 
 isKnownPropertyId ( $id)
 
 isRegistered ( $id)
 
 isVisible ( $id)
 
 isAnnotable ( $id)
 
 isDeclarative ( $id)
 

Static Public Member Functions

static getInstance ()
 
static clear ()
 

Protected Member Functions

 initProperties (array $propertyList)
 

Detailed Description

GNU GPL v2+

Since
2.1
Author
mwjames
Markus Krötzsch

Constructor & Destructor Documentation

◆ __construct()

SMW\PropertyRegistry::__construct ( DataTypeRegistry  $datatypeRegistry,
PropertyLabelFinder  $propertyLabelFinder,
PropertyAliasFinder  $propertyAliasFinder,
array  $dataTypePropertyExemptionList = [] 
)
Since
2.1
Parameters
DataTypeRegistry$datatypeRegistry
PropertyLabelFinder$propertyLabelFinder
PropertyAliasFinder$propertyAliasFinder
array$dataTypePropertyExemptionList

Member Function Documentation

◆ clear()

static SMW\PropertyRegistry::clear ( )
static
Since
2.1

◆ findCanonicalPropertyLabelById()

SMW\PropertyRegistry::findCanonicalPropertyLabelById (   $id)
Since
2.4
Parameters
string$id
Returns
string

◆ findPreferredPropertyLabelFromIdByLanguageCode()

SMW\PropertyRegistry::findPreferredPropertyLabelFromIdByLanguageCode (   $id,
  $languageCode = '' 
)
Since
2.5
Parameters
string$id
string | null$languageCode
Returns
string

◆ findPropertyDescriptionMsgKeyById()

SMW\PropertyRegistry::findPropertyDescriptionMsgKeyById (   $id)
Since
2.5
Parameters
string$id
Returns
string

◆ findPropertyId()

SMW\PropertyRegistry::findPropertyId (   $label,
  $useAlias = true 
)
Deprecated:
since 2.1 use findPropertyIdByLabel instead

◆ findPropertyIdByLabel()

SMW\PropertyRegistry::findPropertyIdByLabel (   $label,
  $useAlias = true 
)

Find and return the ID for the pre-defined property of the given local label. If the label does not belong to a pre-defined property, return false.

Parameters
string$labelnormalized property label
boolean$useAliasdetermining whether to check if the label is an alias
Returns
mixed string property ID or false

◆ findPropertyIdFromLabelByLanguageCode()

SMW\PropertyRegistry::findPropertyIdFromLabelByLanguageCode (   $label,
  $languageCode = '' 
)
Since
2.4
Parameters
string$label
string$languageCode
Returns
mixed string property ID or false

◆ findPropertyLabel()

SMW\PropertyRegistry::findPropertyLabel (   $id)
Deprecated:
since 2.1 use findPropertyLabelById instead

◆ findPropertyLabelById()

SMW\PropertyRegistry::findPropertyLabelById (   $id)

Get the translated user label for a given internal property ID. Returns empty string for properties without a translation (these are usually internal, generated by SMW but not shown to the user).

Note
An empty string is returned for incomplete translation (language bug) or deliberately invisible property
Since
2.1
Parameters
string$id
Returns
string

◆ findPropertyLabelFromIdByLanguageCode()

SMW\PropertyRegistry::findPropertyLabelFromIdByLanguageCode (   $id,
  $languageCode = '' 
)
Since
2.5
Parameters
string$id
string$languageCode
Returns
string

◆ getInstance()

static SMW\PropertyRegistry::getInstance ( )
static
Since
2.1
Returns
PropertyRegistry

◆ getKnownPropertyAliases()

SMW\PropertyRegistry::getKnownPropertyAliases ( )
Since
2.1
Returns
array

◆ getPredefinedPropertyTypeId()

SMW\PropertyRegistry::getPredefinedPropertyTypeId (   $id)
Deprecated:
since 2.1 use getPropertyValueTypeById instead

◆ getPropertyList()

SMW\PropertyRegistry::getPropertyList ( )
Since
2.1
Returns
array

◆ getPropertyTypeId()

SMW\PropertyRegistry::getPropertyTypeId (   $id)

◆ getPropertyValueTypeById()

SMW\PropertyRegistry::getPropertyValueTypeById (   $id)

Get the type ID of a predefined property, or '' if the property is not predefined. The function is guaranteed to return a type ID for keys of properties where isUserDefined() returns false.

Parameters
string$id
Returns
string

◆ initProperties()

SMW\PropertyRegistry::initProperties ( array  $propertyList)
protected
Note
All ids must start with underscores. The translation for each ID, if any, is defined in the language files. Properties without translation cannot be entered by or displayed to users, whatever their "show" value below.

◆ isAnnotable()

SMW\PropertyRegistry::isAnnotable (   $id)
Since
3.0
Parameters
string$id
Returns
boolean

◆ isDeclarative()

SMW\PropertyRegistry::isDeclarative (   $id)
Since
3.0
Parameters
string$id
Returns
boolean

◆ isKnownPropertyId()

SMW\PropertyRegistry::isKnownPropertyId (   $id)
Deprecated:
since 3.0 use isRegistered instead

◆ isRegistered()

SMW\PropertyRegistry::isRegistered (   $id)
Since
2.1
Parameters
string$id
Returns
boolean

◆ isVisible()

SMW\PropertyRegistry::isVisible (   $id)
Since
2.1
Parameters
string$id
Returns
boolean

◆ registerProperty()

SMW\PropertyRegistry::registerProperty (   $id,
  $valueType,
  $label = false,
  $isVisible = false,
  $isAnnotable = true 
)

A method for registering/overwriting predefined properties for SMW. It should be called from within the hook 'smwInitProperties' only. IDs should start with three underscores "___" to avoid current and future confusion with SMW built-ins.

Parameters
string$id
string$valueTypeSMW type id
string | bool$labeluser label or false (internal property)
boolean$isVisibleonly used if label is given, see isShown()
boolean$isAnnotable

◆ registerPropertyAlias()

SMW\PropertyRegistry::registerPropertyAlias (   $id,
  $label 
)

Add a new alias label to an existing property ID. Note that every ID should have a primary label, either provided by SMW or registered with registerProperty().

Parameters
$idstring id of a property
$labelstring alias label for the property
Note
Always use registerProperty() for the first label. No property that has used "false" for a label on registration should have an alias.

◆ registerPropertyAliasByMsgKey()

SMW\PropertyRegistry::registerPropertyAliasByMsgKey (   $id,
  $msgKey 
)

Register an alias using a message key to allow fetching localized labels dynamically (for when the user language is changed etc).

Since
2.4
Parameters
string$id
string$msgKey

◆ registerPropertyDescriptionByMsgKey()

SMW\PropertyRegistry::registerPropertyDescriptionByMsgKey (   $id,
  $msgKey 
)

Register a description message key for allowing it to be displayed in a localized context.

Since
2.5
Parameters
string$id
string$msgKey

◆ registerPropertyDescriptionMsgKeyById()

SMW\PropertyRegistry::registerPropertyDescriptionMsgKeyById (   $id,
  $msgKey 
)

The documentation for this class was generated from the following file:

About | General disclaimer | Privacy policy