Closed (duplicate)
Project:
Editview
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 Nov 2009 at 08:13 UTC
Updated:
1 Mar 2010 at 03:47 UTC
Jump to comment: Most recent
Comments
Comment #1
benjah commentedSee this comment. Worked for me.
http://drupal.org/node/477268#comment-1659816
Comment #2
benjah commentedIncidentally, I needed something different in my case.
I needed to only show the add form if the max number of child nodes had not yet been created.
I did this by hacking editview/includes/editview_plugin_style_node_add.inc.
I set the max number of nodes using 'items_per_page'. I check that against the number of returned results.
If it is equal or greater, I do not display the new node form.
Hope it helps someone. Kind of a hack so I don't recommend this as a patch.
Index: modules/editview/includes/editview_plugin_style_node_add.inc
===================================================================
--- modules/editview/includes/editview_plugin_style_node_add.inc (revision 24)
+++ modules/editview/includes/editview_plugin_style_node_add.inc (working copy)
@@ -108,7 +108,18 @@
array_unshift($this->view->result, $node);
}
else {
- array_push($this->view->result, $node);
+ $result = $this->view->args;
+ $pager = $this->view->pager;
+ if ($result[0] == 0) {
+ $result_count = 0;
+ } else {
+ $result_count = count(explode(",", $result[0]));
+ }
+ $add_limit = $pager['items_per_page'];
+ if ($result_count < $add_limit) {
+ array_push($this->view->result, $node);
+ }
}
}
return parent::render();
Comment #3
liquidcms commentedperfect.. thanks.
Comment #4
_paul_meta commented+1 for this - it makes sense to have this as an option when setting up the editview - as to whether to include the add node interface or not.
thanks :)
Comment #5
liquidcms commentedsorry, not sure my post was clear, it was the post listed in http://drupal.org/node/635910#comment-2307610 that worked for me.
Comment #6
Anonymous (not verified) commentedAs benjah said, #477268: Add new node as Option (disabled) describes the solution for this.
Marking as a duplicate of that issue.