We configured our "Hours Minutes and Seconds" field to use "Natural language" (Administration > Structure > Content types > [name of content type] >> Manage display). When we did this, the node view didn't display the value of the field. In addition, we encountered the following errors:
Notice: Undefined offset: 0 in _hms_seconds_to_formatted() (line 541 of [redacted]\sites\all\modules\hms_field\hms_field.module).
Notice: Undefined offset: 1 in _hms_seconds_to_formatted() (line 541 of [redacted]\sites\all\modules\hms_field\hms_field.module).
Notice: Undefined offset: 2 in _hms_seconds_to_formatted() (line 541 of [redacted]\sites\all\modules\hms_field\hms_field.module).
Notice: Undefined offset: 3 in _hms_seconds_to_formatted() (line 541 of [redacted]\sites\all\modules\hms_field\hms_field.module).
Notice: Undefined offset: 4 in _hms_seconds_to_formatted() (line 541 of [redacted]\sites\all\modules\hms_field\hms_field.module).
Weirdly, we used "Natural language" on two different content types. Both initially produced the same errors. Now, event though the two "Hours Minutes and Seconds" fields are both configured exactly the same (including the Manage display settings), one field works fine now, while the other continues to have the problems mentioned above. It's almost like saving the configuration in a certain order caused one of them to work; but who knows what sequence of events got us there.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | hms_field-natural-lang-format-error-2657228.patch | 751 bytes | slanger |
Comments
Comment #2
slanger commentedThis patch fixed the problem for us.
Here's what we uncovered: On line 137 of hms_field.module, "display_formats" is set as an array, which contains the format tokens. However, on line 258, rather than using the value of the array elements ('w', 'd', 'h', 'm', 's'), it uses the keys instead (0, 1 , 2, 3, 4), resulting in the errors I listed previously.
Comment #4
slanger commentedComment #6
ssimdev commentedI tested the patch and works fine.
Comment #8
msajko commented