Thread:Talk:Hooks/Alias for a special property/reply

> DIProperty::registerPropertyAlias ('_SUBP', 'Подчинённое свойству');

DIProperty::registerPropertyAlias is deprecated, see [0] (object registration and entity representation are two distinct responsibilities)

> Unfortunately, now it causes a fatal error due to the fact that $smwgContLang is not initialised yet.

Using direct object registration in LocalSettings.php is discouraged as an object might rely on an internal dependency that have not yet been loaded by the time LocalSettings is accessed (as with the Language, or NS constants etc.).

> Looks like I should use a hook. But which hook should it be? The SMW hooks that look useful are listed as deprecated.

'SMW::Property::initProperties', see [1]

$GLOBALS['wgHooks']['SMW::Property::initProperties'][] = function { \SMW\PropertyRegistry::getInstance->registerPropertyAlias( $id, $label ); };

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/includes/dataitems/SMW_DI_Property.php#L379

[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/src/PropertyRegistry.php#L334