Problem/Motivation
Following up from #3444046: Warning: Undefined array key "time_wrapper", the following warning is emitted when the end date is in an invalid state.
Warning: Undefined array key "time_wrapper" in Drupal\smart_date_recur\Entity\SmartDateRule::validateRecurring() (line 945 of modules/contrib/smart_date/modules/smart_date_recur/src/Entity/SmartDateRule.php).
Warning: Trying to access array offset on value of type null in Drupal\smart_date_recur\Entity\SmartDateRule::validateRecurring() (line 945 of modules/contrib/smart_date/modules/smart_date_recur/src/Entity/SmartDateRule.php).
Similarly to #3477741: Start/End Date error messages, the warning message is also applied on the global element, rather than the specific end date.
Steps to reproduce
1. Create a recurring date with a start and end date of 04/11/2024 01:00 PM - 04/11/2024 02:00 PM.
2. Specify that it repeats weekly on Monday, and has an ends on date of 28/10/2024.
3. The error is triggered.
Proposed resolution
1. Fallback to using the title from the value element for the error message.
2. Apply the error message on the end date field.
Remaining tasks
Provide issue fork.
User interface changes
N/A
Issue fork smart_date-3483466
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
abhishek_gupta1 commented@codebymikey, I have fixed the issue and created MR. Please review it once
Comment #5
codebymikey commentedHi @abhishek_gupta1, the MR partially addresses the issue, but currently has some coding standards issues as well as making changes to other unaffected parts of the code. The merge request title and commit messages also aren't the most helpful for reviewing, you should try to follow the Drupal commit message format as suggested in the Credit & committing section of the page.
I have a fix I'm working on locally that addresses the issue whilst also supporting translated content, so will probably force-push that into the issue fork instead (but since I can't change the merge request title, I might push mine into a separate branch instead). Thanks for attempting to fix the issue though.
Comment #7
codebymikey commentedThe fix for that will be addressed in that issue so as not to conflate issues.
Comment #9
codebymikey commentedComment #10
mandclu commentedComment #11
mandclu commentedThanks for identifying this, and for the work to implement a fix. Merged in.
Comment #13
codebymikey commentedIt doesn't appear the MR has been merged in.