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=array())
 
 getKnownPropertyTypes ()
 
 getKnownPropertyAliases ()
 
 registerProperty ($id, $typeId, $label=false, $isVisible=false, $isAnnotable=true)
 
 registerPropertyAlias ($id, $label)
 
 registerPropertyAliasByMsgKey ($id, $msgKey)
 
 registerPropertyDescriptionMsgKeyById ($id, $msgKey)
 
 findPropertyDescriptionMsgKeyById ($id)
 
 findPropertyLabelById ($id)
 
 findCanonicalPropertyLabelById ($id)
 
 findPropertyLabelByLanguageCode ($id, $languageCode= '')
 
 findPropertyLabel ($id)
 
 getPropertyTypeId ($id)
 
 getPredefinedPropertyTypeId ($id)
 
 findPropertyIdByLabel ($label, $useAlias=true)
 
 findPropertyIdFromLabelByLanguageCode ($label, $languageCode= '')
 
 findPreferredPropertyLabelById ($id, $languageCode= '')
 
 findPropertyId ($label, $useAlias=true)
 
 isKnownPropertyId ($id)
 
 isVisibleToUser ($id)
 
 isUnrestrictedForAnnotationUse ($id)
 

Static Public Member Functions

static getInstance ()
 
static clear ()
 

Protected Member Functions

 registerPredefinedProperties ($useCategoryHierarchy)
 

Detailed Description

GNU GPL v2+

Since
2.1
Author
mwjames
Markus Krötzsch

Constructor & Destructor Documentation

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

Member Function Documentation

static SMW\PropertyRegistry::clear ( )
static
Since
2.1
SMW\PropertyRegistry::findCanonicalPropertyLabelById (   $id)
Since
2.4
Parameters
string$id
Returns
string
SMW\PropertyRegistry::findPreferredPropertyLabelById (   $id,
  $languageCode = '' 
)
Since
2.5
Parameters
string$id
string | null$languageCode
Returns
string
SMW\PropertyRegistry::findPropertyDescriptionMsgKeyById (   $id)
Since
2.5
Parameters
string$id
Returns
string
SMW\PropertyRegistry::findPropertyId (   $label,
  $useAlias = true 
)
Deprecated:
since 2.1 use findPropertyIdByLabel instead
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
SMW\PropertyRegistry::findPropertyIdFromLabelByLanguageCode (   $label,
  $languageCode = '' 
)
Since
2.4
Parameters
string$label
string$languageCode
Returns
mixed string property ID or false
SMW\PropertyRegistry::findPropertyLabel (   $id)
Deprecated:
since 2.1 use findPropertyLabelById instead
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
SMW\PropertyRegistry::findPropertyLabelByLanguageCode (   $id,
  $languageCode = '' 
)
Since
2.5
Parameters
string$id
string$languageCode
Returns
string
static SMW\PropertyRegistry::getInstance ( )
static
Since
2.1
Returns
PropertyRegistry
SMW\PropertyRegistry::getKnownPropertyAliases ( )
Since
2.1
Returns
array
SMW\PropertyRegistry::getKnownPropertyTypes ( )
Since
2.1
Returns
array
SMW\PropertyRegistry::getPredefinedPropertyTypeId (   $id)
Deprecated:
since 2.1 use getPropertyTypeId instead
SMW\PropertyRegistry::getPropertyTypeId (   $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
SMW\PropertyRegistry::isKnownPropertyId (   $id)
Since
2.1
Parameters
string$id
Returns
boolean
SMW\PropertyRegistry::isUnrestrictedForAnnotationUse (   $id)
Since
2.2
Parameters
string$id
Returns
boolean
SMW\PropertyRegistry::isVisibleToUser (   $id)
Since
2.1
Parameters
string$id
Returns
boolean
SMW\PropertyRegistry::registerPredefinedProperties (   $useCategoryHierarchy)
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.
SMW\PropertyRegistry::registerProperty (   $id,
  $typeId,
  $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$typeIdSMW type id
string | bool$labeluser label or false (internal property)
boolean$isVisibleonly used if label is given, see isShown()
boolean$isAnnotable
Note
See self::isShown() for information it
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.
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
SMW\PropertyRegistry::registerPropertyDescriptionMsgKeyById (   $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

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