I ran into an issue with fixed default date arguments while creating some views that use a path containing node/%/
I believe I have located the bug within the views_handler_argument_date.inc file.
The code in the get_default_argument() method checks if the url path contains node/nid and if it does it attempts to load the node.
If it doesn't manage to load a node, default argument types such as default & php will work normally.
However if it does manage to load a node, the method only handles node_created and node_changed argument types correctly.
I have attached a sample view to reproduce this issue, once imported you need to visit a path such as
node/nid/news - replace nid for a valid node id.
As it stands you will get a page not found, unless you specify the argument explicitly such as - node/nid/news/all
With the attached patch, I add a check to see if it needs to even try to load the node - if not it just passes to the parent handler's method.
| Comment | File | Size | Author |
|---|---|---|---|
| date_argument_default.patch | 636 bytes | smoothify | |
| date_argument_default_export.txt | 3.55 KB | smoothify |
Comments
Comment #1
smoothify commentedI did search the issue queue, and found a similar issue here, which was closed:
#380478: Default argument for 'Node: Created year' does not work
Also another issue on the Date API queue, which is affected by this too
#459566: date arguments not passed to block view
Comment #2
smoothify commentedadjust title
Comment #3
merlinofchaos commentedSetting correct status.
Comment #4
merlinofchaos commentedFixed in 6.x -- does not apply to 7.x, needs porting.
Comment #5
dawehnerand ported.
The problem was that time() was moved to REQUEST_TIME