Argument Picker API
Categories
Component ID
Component name
Component type
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
Argument Picker is a simple API to access and elaborate arguments in a flexible way.
Basically it allows, given URL arguments like:
example.com/myview/make:Volkswagen/model:Polo/year:2008/
to retrieve one of those arguments through a function:
arg_picker_get_selector_argument("make")
which - in the specific example - would return "Volkswagen".
This module essentially adds the possibility to assign labels to arguments, through this syntax:
www.example.com/your_view/LABEL1:ARG1/LABEL2:ARG2/LABEL3:ARG3
and then allows you to retrieve any argument using the label as a reference.
Some of the helper functions are dedicated to specific modules (i.e. Views), enhancing the accessibility of arguments:
www.example.com/your_view/something/bar:1/foo:4/other/parameters
Assuming "your_view" has a "foo" argument, using argument_picker, you could easily setup this argument's default value with:
<?php
return arg_picker_get_view_argument("foo");
?>
which would return "4" (for the example above) or "all" (when the argument is not present).
Basically it's just an alternative to an url querystring with Drupal-specific add-on features, which comes extremely useful when implementing progressive filters (like a faceted search) through views but it also comes very handy for retrieving arguments in dynamic PHP blocks, panel panes, custom modules or wherever you want.
Not to mention that a normal querystring is still usable:
www.example.com/node/add/page/author:Aldus/?query1=...&query2=...
leaving every other querystring-related features intact.