Last modified: 2014-09-18 18:08:48 UTC
SMW 1.8.x Hello, semantic properties do not show up on factbox if programatically generated via PHP. Someone allready commented this with the advice to invalidate the cache without explaining how. I guess I do this and it seems to be a real bug not a cache problem. Here comes the code...every tip/hint/fix is very welcome! [...] SMWDIProperty::registerProperty( '___EXIFSOFTWARE', '_str','MyNewProp'); SMWDIProperty::registerPropertyAlias( '___EXIFSOFTWARE', 'MyNewProp' ) [...] public function UpdateDataBefore($store, $data ){ global $wgUser,$wgEnableParserCache,$wgParser; $wgParser->disableCache(); $wgEnableParserCache = false; $str = "EinTestString"; $property = new SMWDIProperty( '___EXIFSOFTWARE' ); $dataItem = new SMWDIString( $str ); $data->addPropertyObjectValue($property, $dataItem); [...] PS: 1. The Properties show up on Special:Browse but not on the factbox! Also the PHP-generated properties are automatically declared as special properties...I don't know why. Could someone explain? 2. If someone could provide some code snipped too, to demonstrate how to manipulate -->$data<-- on the fly in an UpdateDataBefore-handler this would be very very nice and open some doors to new innovations. This doc here is not enough: http://semantic-mediawiki.org/wiki/SMW_Hooks/SMWStore::updateDataBefore
Using the [0] hook will enable you to show extra content but using `SMWStore::updateDataBefore` is the incorrect use for having additional data shown in the Factbox. [0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/includes/src/Factbox/Factbox.php#L249