It would be great if you could set a default for an argument (in case the argument is optional).
I'd be willing to help code it, if it sounds like a good feature to add.

CommentFileSizeAuthor
#3 ctools_default_for_arg.patch5.98 KBmoonray

Comments

moonray’s picture

Title: Default argument » Default for argument
merlinofchaos’s picture

This totally makes sense, though it can be a rather complex operation to do right (see the fun in Views there) -- patches welcome!

moonray’s picture

Assigned: Unassigned » moonray
Status: Active » Needs review
StatusFileSize
new5.98 KB

Attached is a patch that adds default argument handling for the delegator module. I didn't apply it anywhere else, since I wanted feedback on it first.

Also, if you could provide a list of files I would need to add this code to, it would be appreciated. That way I wont miss any.

merlinofchaos’s picture

Wow. Ok, so this patch is awesome, and it totally won't apply since as of last night, delegator.module is history. I like this enough I may try to manually recreate it, though. This is good stuff!

merlinofchaos’s picture

Status: Needs review » Needs work

I'm thinking about the utility of this in terms of the new UI. And '404' is an unnecessary option. If you want to 404 if the argument is not there, then it's not an optional argument.

So what this really is for is to provide defaults if the argument is not specified. To do that we probably need to hook into the context UI so that the defaults can be provided by whatever UI is there. That makes it easy to provide default terms by selection rather than just entering a number for example. It's possible we'll need some way to do PHP code selection of a default, as well, though the need for that is a little less than it is with Views where you often have to extract defaults from URLs for blocks. This one you always have the URLs. Still, this bears some thinking about. We should consider as many use cases, as possible, of what we might want to do if arguments do not exist.

japerry’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

Closing this issue as outdated as Drupal 6 ctools is not supported. If this issue is relevant for Drupal 7, feel free to re-open and mark for Drupal 7 (or 8)