r91538 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91537‎ | r91538 | r91539 >
Date:09:04, 6 July 2011
Author:mkroetzsch
Status:deferred
Tags:
Comment:
for each datatype, add a predefined property of the same name that has this type
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_Property.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_Property.php
@@ -255,7 +255,7 @@
256256 * @param $useAlias boolean determining whether to check if the label is an alias
257257 * @return mixed string property ID or false
258258 */
259 - static protected function findPropertyID( $label, $useAlias = true ) {
 259+ protected static function findPropertyID( $label, $useAlias = true ) {
260260 SMWDIProperty::initPropertyRegistration();
261261 $id = array_search( $label, SMWDIProperty::$m_prop_labels );
262262 if ( $id !== false ) {
@@ -308,8 +308,9 @@
309309 }
310310
311311 global $smwgContLang, $smwgUseCategoryHierarchy;
312 - SMWDIProperty::$m_prop_labels = $smwgContLang->getPropertyLabels();
313 - SMWDIProperty::$m_prop_aliases = $smwgContLang->getPropertyAliases();
 312+ $datatypeLabels = $smwgContLang->getDatatypeLabels();
 313+ SMWDIProperty::$m_prop_labels = $smwgContLang->getPropertyLabels() + $datatypeLabels;
 314+ SMWDIProperty::$m_prop_aliases = $smwgContLang->getPropertyAliases() + $smwgContLang->getDatatypeAliases();
314315 // Setup built-in predefined properties.
315316 // NOTE: all ids must start with underscores. The translation
316317 // for each ID, if any, is defined in the language files.
@@ -335,6 +336,11 @@
336337 '_SF_DF' => array( '__spf', true ), // Semantic Form's default form property
337338 '_SF_AF' => array( '__spf', true ), // Semantic Form's alternate form property
338339 );
 340+
 341+ foreach ( $datatypeLabels as $typeid => $label ) {
 342+ SMWDIProperty::$m_prop_types[$typeid] = array( $typeid, true );
 343+ }
 344+
339345 wfRunHooks( 'smwInitProperties' );
340346 }
341347