Last modified: 2012-05-14 14:26:52 UTC
Created attachment 10566 [details] Patch has been made against SD SVN revision 115163 A patch which introduces a new parser function called #drilldown to enable links [2] pointing to Semantic Drilldown much like #formlink does in Semantic Forms. ==Example == {{#drilldown:Psychology|subcat=Bounded rationality|link text=Drilldown on Bounded rationality|single}} {{#drilldown:category=Psychology|subcat=Bounded rationality|filter=Subject=Decision making|link text=Drilldown on Bounded rationality|single}} ==Parameter == # category parameter is either empty, or specified through [cat=], [category=] # subcategory parameter is identified by either [subcat=] or [subcategory=] # filter parameters can be specified through [filter=Subject=Advertising&Keyword=Branding] or [filter=Subject=Advertising] [filter=Keyword=Branding] # [single] is a parameter identifier to achieve [1] # other supported parameters are [link text=], [tooltip=] ==Notes == [1] http://www.mediawiki.org/wiki/SD#Removing_the_list_of_categories
Hi, thanks for this patch! SD has needed something like this for a long time. The calls to array_merge_recursive_distinct() and http_build_query() seem like overkill here - are you sure they're needed? In the case of #formlink, they're used because #formlink allows arbitrary parameters (it adds them all to the query string) - #drilldown doesn't do that. And #formlink didn't use them until a few months ago: r1=110324&r2=110685">http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php?r1=110324&r2=110685 Also, any objections to renaming this function to #drilldownlink? Or to changing the name of the parameter "filter" to "filters"?
That URL didn't display very well - let me try that again: svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php?r1=110324&r2=110685
Created attachment 10568 [details] Version 2 of the patch related to #drilldownlink and changes Changes are: # renamed parser function to #drilldownlink # renamed filter parameter to filters # replaced array_merge_recursive_distinct() with simple array_merge # for the time http_build_query() is kept to ensure the query string is correctly escaped Changes have been tested against: * {{#drilldownlink:Book|Subject=Psychology&Keyword=Cognitive_psychology&Language=en|subcat=Textbook}} * {{#drilldownlink:Book|filters=Subject=Psychology&Keyword=Cognitive psychology|filters=Language=en|subcat=Textbook}} * {{#drilldownlink:Book|filters=Subject=Psychology&Keyword=Cognitive psychology|filters=Language=en|subcat=Textbook|single|link text=Single mode}} * {{#drilldownlink:Book|filters=Subject=Psychology&Keyword=Cognitive psychology|filters=Language=en|subcat=Textbook|single|link text=Single mode|tooltip=Display related info}}
I just checked this in to the SD code on SVN, with some minor adjustments. I hope everything still works. And thanks again for the patch!