When I add Office Hours field to a field collection, everything works right except for the "Add more hours" link which just doesn't appear. Same thing happened with 7.x-1.0 version, but there I saw an error message (about non-existing index) and there are issues on that matter in the queue. With dev version, the error doesn't appear, but the issue is still unresolved.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | office_hours.elements.inc_.patch | 1.9 KB | dsrikanth |
| #9 | office_hours.elements.inc_.patch | 981 bytes | dsrikanth |
Comments
Comment #1
johnvjust a guess: does it help to apply the following (and clear caches) ?
#1660480: Property Info callback for Entity API
Comment #2
graker commentedNope, it doesn't.
I guess though, that it's that function that adds "Add more hours" link can't find the office hours field because the field is inside a field collection edit form which is embedded into node edit form. Because when I go to "Add" link (which adds a single field-collection entity without displaying the full node edit form) - "Add office hours" links are in place.
Comment #3
johnvThat might be the case - embedded forms... PITA (Check out the endles issues of Editablefields)
It does work as a normal field, I hope?
Patches are welcome! :-)
Comment #4
graker commentedYes, it does work as a normal field, both in node edit form and in separate (i.e. not embedded) field-collection edit form. So I guess embedded forms are the issue.
I will try to find a way to fix it but not very soon.
Comment #5
johnvWhat is the status with the latest dev-version?
#1126386: Add more hours link not displayed in Profile2 is fixed. Does is work for field_collection, too?
Comment #6
pedrospI can confirm that last release (nor dev) doesn't work as expected in a field collection. (No add more hours + No granularity)
Comment #7
johnvComment #8
dsrikanth commentedI wrote up a patch that works for me. Adding it here in case anyone wants to have a look at it.
This is for 7.x-1.1
Ignore this attachment - see #9
Comment #9
dsrikanth commentedOops wrong file. Attaching the right one...
Comment #10
johnvComment #11
dsrikanth commentedDid more testing with patch at #9. Works fine except when there is a field collection inside a field collection. So I am thinking of a generic solution. Something like the below:
Ideally it should take care of the profile2 issue too. If only I can get the whole [$element['#field_name']][$element['#language']]['field']['settings'] instead of looking for 'addhrs' I would be more confident about this.
Would love to hear your thoughts.
Comment #12
jonhattanPatch in #1168126: Default value for every day of the week fixes this indirectly by providing a more consistent widget.
See #1913292: [META] Untangle office_hours for the broad picture.
Comment #13
richardbporter commentedMaybe I'm missing something but is that the right issue? #1913126: Too many hooks
Thanks.
Comment #14
jonhattan@rbp I've updated #12 with the correct issue numbers.