Commit f37b9ec7 authored by Marijn van Wezel's avatar Marijn van Wezel
Browse files

Automatically get the corresponding non-talk page and change property type

parent f9b3e495
Pipeline #2766 passed with stage
in 8 seconds
{
"name": "Semantic Structured Discussions",
"type": "semantic",
"version": "1.0.1",
"version": "1.1.0",
"author": [
"Marijn van Wezel ([https://wikibase-solutions.com Wikibase Solutions])"
],
......
......@@ -24,6 +24,8 @@ use Flow\Exception\CrossWikiException;
use Flow\Exception\InvalidInputException;
use SMW\DIProperty;
use SMW\SemanticData;
use SMWDIBlob;
use Title;
/**
* This annotation contains information about the owner of a topic.
......@@ -40,9 +42,14 @@ class OwnerAnnotation extends TopicAnnotator {
return;
}
if ( $topicArticle->isTalkPage() ) {
// Get the corresponding non-talk page
$topicArticle = Title::makeTitleSafe( $topicArticle->getNamespace() - 1, $topicArticle->getText() );
}
$semanticData->addPropertyObjectValue(
new DIProperty( self::getId() ),
new \SMWDIWikiPage( $topicArticle->getDBkey(), $topicArticle->getNamespace() )
new SMWDIBlob( $topicArticle->getFullText() )
);
}
......@@ -66,7 +73,7 @@ class OwnerAnnotation extends TopicAnnotator {
public static function getDefinition(): array {
return [
'label' => self::getLabel(),
'type' => '_wpg',
'type' => '_txt',
'viewable' => true,
'annotable' => false
];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment