Closed (fixed)
Project:
Project issue tracking
Version:
7.x-2.x-dev
Component:
Issues
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
27 Apr 2012 at 20:25 UTC
Updated:
4 Jan 2014 at 02:05 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dwwSee also #1551208: Don't have both "Anonymous" and "- None -" options for assigned; just use None. for a related but distinct problem.
Comment #2
mikey_p commentedNote that this will also have to tie into the maintainers system, which is still in progress: #1551156: Port maintainers system from D6
Comment #3
dwwActually, I just closed #1551208: Don't have both "Anonymous" and "- None -" options for assigned; just use None. as a duplicate. Really, this issue can take care of that, too. The point is that whatever we do here to populate the allowed values, we want to *not* include "Anonymous" and just use the default Field API value of "- None -" for issues that aren't currently assigned.
Comment #4
mikey_p commentedSo this ended up being a little crazy, but here goes.
Not even sure how to try to explain this. I'm probably over-engineering this because I stayed up too late.
Comment #5
dwwExcellent! This is a great start, and it's definitely most of the way there. This is almost exactly what I had in mind.
However, a few concerns:
A) Looks like
ProjectIssue_SelectionHandler_Assignedduplicates a *lot* of functions (exactly) fromEntityReference_SelectionHandler_Generic. Any reason we can't just have:class ProjectIssue_SelectionHandler_Assigned extends EntityReference_SelectionHandler_Generic implements EntityReference_SelectionHandler?For example:
getReferencableEntities()is identical (except for thecheck_plain()on the label -- seems like ours would lead to double-escaping in that case?)parent::settingsForm()and then add the Project field stuff (and maybe hide something we don't need)?countReferencableEntities()is identicalvalidateReferencableEntities()is identicalentityFieldQueryAlter()is identicalgetLabel()is identicalbuildEntityFieldQuery()is nearly identical -- could we just alter viaentityFieldQueryAlter()to add this:$query->propertyCondition('uid', $this->getAllowedAssignees(), 'IN');?B) What's up with
validateAutocompleteInput()? It doesn't seem like it's getting called anywhere, nor that there's any other support for doing this selection widget as an autocomplete instead of a select dropdown. If we do keep it here, the convention is for @see to go at the end of the PHPDoc block, after @return. That said, dereferencing the @see didn't help me understand this any better. ;) So, if this is actually being used somehow, maybe you could explain that better in the comment?C) Inside
project_issue_project_issue_assignees(), why do we needLIKEhere:WHERE permission LIKE :perm? In D7, now that we have
{role_permission}, it's just a separate row in the table for each perm assigned to a role.D) Extra "of" in this PHPdoc:
E) When I actually try to run this on my local dev site, I get a fatal error at node/add/project-issue/[whatever]:
Looks like in this case,
getAllowedAssignees()is confused since$this->entityis still NULL at this point, so we never bother callingproject_issue_assigned_choices().F) Maybe to address my concern from comment #3 and #1551208: Don't have both "Anonymous" and "- None -" options for assigned; just use None. we should have
project_issue_assigned_choices()responsible for always callingunset($assigned[0])so that "Anonymous" never shows up as an option? Can you think of a better/cleaner place to do that?Hopefully these are relatively easy fixes. Let me know what you think.
Thanks!
-Derek
Comment #6
senpai commentedTagging for Sprint 4.
Comment #7
dwwStill needs work.
Comment #8
mikey_p commentedUpdated patch, I think I addressed everything from #5, and we now inherit from EntityReference_SelectionHandler_Generic so we include alot less code.
FWIW, the autocomplete does work on existing nodes, but not on new nodes. The issue seems to be that the select list can use the empty entity present while creating the form, but the autocomplete callback doesn't have this info. I don't see any reason to take this functionality out (I'm not even sure we can).
Comment #9
dwwExcellent, much better, thanks!
A few lingering concerns:
G) Wouldn't hurt to have some PHPDoc for ProjectIssue_SelectionHandler_Assigned::getAllowedAssignees(), especially since it returns either an array or FALSE. Maybe it's better to just always have it return an array() and if there are no allowed values, the array is empty? That'd simplify a bunch of the else { return FALSE } stuff and not have multiple return points. Just have it
return $returnin all cases, and just let that be empty or not as appropriate.H) Totally minor, but this should be a real English sentence:
// Remove anonymous user from listI) While testing, I'm hitting this when trying to update an issue:
That appears to be b/c there's no longer a constructor at all, so we're not saving the $entity from the factory. That breaks the rest of the logic, so I can't really test much else.
Comment #10
dwwHeh, whoops. (I) is a non-issue. I was just running a stale copy of entityreference. You need at least rc3 for all this to work. Once I upgraded, that's all working fine.
Based on the IRC conversation where mikey_p sorted me out on that, I'm going to take this to clean up the other minor stuff from #9. Stay tuned.
Thanks,
-Derek
Comment #11
dwwp.s. And I just fixed projectinstall for this: a361522
Comment #12
dwwNow that I'm using entityreference 7.x-1.0-rc3, it's all working nicely in my local testing. I cleaned up the other minor issues from #9, committed, and pushed to 7.x-2.x.
Thanks!
-Derek
Comment #13
dwwFollow-up if anyone's interested: #1633020: Port issue maintainer tests to D7