https://bugzilla.wikimedia.org/show_bug.cgi?id=21891


Markus Krötzsch <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|mar...@semantic-            |[email protected]
                   |mediawiki.org               |




--- Comment #2 from Markus Krötzsch <[email protected]>  2009-12-30 
10:52:46 UTC ---
This problem can now be addressed by introducing a new custom extension
datatype in Semantic Drilldown. Below is example code on how to do this. The
code works in LocalSettings.php but obviously it should rather be split across
multiple files in any given extension (use autoloading to let PHP locate the
datatype class when given in a separate file).

Example on how to set up a custom wiki page type that enforces values to be in
the Help namespace:

class MyHelpPageValue extends SMWWikiPageValue {
        public function __construct($typeid) {
                parent::__construct($typeid);
                $this->m_fixNamespace = NS_HELP;
        }
}

$wgHooks['smwInitDatatypes'][] = 'myinitDatatypes';

function myinitDatatypes() {
        SMWDataValueFactory::registerDatatype('___help', 'MyHelpPageValue',
'Helppage');
        SMWDataValueFactory::registerDatatypeAlias('___help', 'Help page');
        return true;
}

The type in this example will be called "Helppage" in the wiki, and "Help page"
will work as an alias. Please use "___" as a prefix for the type id to prevent
clashes with future types used in SMW. Similar code can also be used for other
custom types, where types that do not derive from SMWWikiPageValue are treated
like Strings/Numbers. Custom types based on long strings (Text) are not
supported.


-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to