Skip to content

Commit

Permalink
handling types and version
Browse files Browse the repository at this point in the history
  • Loading branch information
toniher committed Oct 20, 2016
1 parent ebced23 commit 42e81b5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
7 changes: 3 additions & 4 deletions SMWParent.i18n.magic.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

/** English (English) */
$magicWords['en'] = array(
'SMWParent' => array( 0, 'SMWParent' ),
'SMWChildren' => array( 0, 'SMWChildren' ),
'SMWTree' => array( 0, 'SMWTree' ),
'SMWEntityIterate' => array( 0, 'SMWEntityIterate' )
'SMWParent' => array( 0, 'SMWParent' ),
'SMWChildren' => array( 0, 'SMWChildren' ),
'SMWTree' => array( 0, 'SMWTree' )
);

2 changes: 1 addition & 1 deletion SMWParent.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'author' => array(
'[https://www.mediawiki.org/wiki/User:Toniher Toni Hermoso]'
),
'version' => '0.1',
'version' => '0.2.0',
'url' => 'https://www.mediawiki.org/wiki/Extension:SMWParent',
'descriptionmsg' => 'smwparent-desc',
);
Expand Down
3 changes: 2 additions & 1 deletion extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"wgSMWParentdefault": "Request",
"wgSMWChildrendefault": "File",
"wgSMWParentTypeProperty": ["Is_Type"],
"wgSMWParentProps": ["Comes_from_Process", "Comes_from_Sample", "Has_Request"]
"wgSMWParentProps": ["Comes_from_Process", "Comes_from_Sample", "Has_Request"],
"wgSMWParentPrintProps": []
},
"ExtensionMessagesFiles": {
"SMWParentMagic": "SMWParent.i18n.magic.php"
Expand Down
2 changes: 1 addition & 1 deletion includes/SMWParent.hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public static function onParserFirstCallInit( $parser ) {

$parser->setFunctionHook( 'SMWParent', 'SMWParentParser::parseParent', Parser::SFH_OBJECT_ARGS );
$parser->setFunctionHook( 'SMWChildren', 'SMWParentParser::parseChildren', Parser::SFH_OBJECT_ARGS );
$parser->setFunctionHook( 'SMWTree', 'SMWParentParser::parseTree', Parser::SFH_OBJECT_ARGS );
// $parser->setFunctionHook( 'SMWTree', 'SMWParentParser::parseTree', Parser::SFH_OBJECT_ARGS ); Disabled for now

// Always return true from this function. The return value does not denote
// success or otherwise have meaning - it just must always be true.
Expand Down
12 changes: 10 additions & 2 deletions includes/api/SMWParent.api.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ public function execute() {
$input = array();
$input['child_text'] = $params['title'];
$input['parent_text'] = $params['title'];
$input['parent_type'] = $params['type'];
$input['children_type'] = $params['type'];

// If type has ','
$types = explode( ",", $params['type'] );
if ( count( $types ) > 1 ) {
$input['parent_type'] = $types[0];
$input['children_type'] = $types[1];
} else {
$input['parent_type'] = $types[0];
$input['children_type'] = $types[0];
}

$input['link_properties'] = $wgSMWParentProps;
$input['type_properties'] = $wgSMWParentTypeProperty;
Expand Down

0 comments on commit 42e81b5

Please sign in to comment.