Page MenuHomePhabricator

[SD] Add new parser function #drilldownlink
Closed, ResolvedPublic

Description

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

Parameter

  1. category parameter is either empty, or specified through [cat=], [category=]
  2. subcategory parameter is identified by either [subcat=] or [subcategory=]
  3. filter parameters can be specified through [filter=Subject=Advertising&Keyword=Branding] or [filter=Subject=Advertising] [filter=Keyword=Branding]
  4. [single] is a parameter identifier to achieve [1]
  5. other supported parameters are [link text=], [tooltip=]

Notes

[1] http://www.mediawiki.org/wiki/SD#Removing_the_list_of_categories


Version: unspecified
Severity: enhancement

attachment SD-drilldown-parser-115163.patch ignored as obsolete

Details

Reference
bz36693

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:24 AM
bzimport set Reference to bz36693.

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:

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

Unknown Object (User) added a comment.May 9 2012, 2:53 PM

Version 2 of the patch related to #drilldownlink and changes

Changes are:

  1. renamed parser function to #drilldownlink
  2. renamed filter parameter to filters
  3. replaced array_merge_recursive_distinct() with simple array_merge
  4. for the time http_build_query() is kept to ensure the query string is correctly escaped

Changes have been tested against:

Attached:

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!