Over at #1549808: Port the lame D6 node/add/project-issue UI to D7 there's a patch that would really benefit from a project_issue_entity_bundles() helper function, similar to project_project_entity_bundles() from #1549538: Add a function to determine if a node or node type is a project. That'll help us write code that properly handles the fact that many different node types (aka entity bundles) can behave as issue types.
On projects, we know a node type is a project via the existence of the project_type field. However, for issues, there's just a per-node-type setting that controls this. See #1569524: Add a 'Project settings' tab on node type edit forms for more. So this function needs to ask core for all the node types on the system, iterate over them, and for each one, check this setting.
While we're at it, we might as well add functions like project_issue_entity_bundle_is_issue() and project_issue_node_is_issue($node). See the equivalents in project.module for more.
Since we need this for other things, assigning this to sprint 2.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 1580178-3.pi-node-type-helpers.patch | 1.8 KB | dww |
Comments
Comment #1
dwwI updated the summary to expand the scope a bit, so re-titling.
Comment #2
dwwI'll take a quick stab at this. Stay tuned.
Comment #3
dwwAfter looking more closely at the project.module code, I want to reopen #1549538: Add a function to determine if a node or node type is a project. ;) It's a bit of a confused mess of trying to be entity-generic but ultimately relying on the fact that we assume nodes, anyway. I think it's going to be simpler and cleaner to just embrace the fact that we're assuming nodes for all this stuff, and make the API match that. So, here's my proposed API for project_issue. If folks are cool with this, I'll fix project.module to match.
Thoughts?
-Derek
Comment #4
mikey_p commentedLooks good, I don't see any particular reason to use node_type_get_names() over any of the other node_type_get*() functions so I don't suppose that makes any difference.
Comment #5
dwwYeah, I was using node_type_get_names() before I realized that was labels, not machine_names. But, I still get what I need in the keys, so that seemed as good as any. ;)
Anyway, tested again locally and committed/pushed.
Thanks for the review!
-Derek
Comment #6.0
(not verified) commentedexpanding summary to talk about how this should work and to request a few other helper functions