Closed (fixed)
Project:
Scheduler
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Jul 2018 at 16:30 UTC
Updated:
30 Mar 2019 at 10:22 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
captainpants commentedHere's a patch file that solves the issue.
Comment #3
nlisgo commentedComment #4
nlisgo commentedComment #5
asherry commentedThe solution in #4 gets rid of the error, but the form elements are still being populated. It seems like it'd be better to just skip the entire form_alter altogether if either of the elements are hidden.
I'm attaching a patch that will just simply bail if the components aren't displayed. At the very least an easier way to get the display info is:
And then you can check each component with:
or...
Comment #7
asherry commentedSorry I had a typo, here is the right patch.
Comment #8
asherry commentedComment #9
mpp commentedThanks!
Comment #10
jonathan1055 commentedThanks for the work and the patch. However, are you sure that it is correct to bail out with an OR test? That means if either of the components are not displayed we process no further.
We also need test coverage for this.
Comment #11
nlisgo commentedComment #12
jonathan1055 commentedHere is patch which adds a test to make sure that a disabled scheduler field is not displayed, that the non-disabled field is still displayed, and that the undefined index error does not occur. This will fail because this patch only includes the new test, and not any code fix from
scheduler_form_node_form_alter().I am also attempting, via a change to the newly added drupalci.yml, to only run this one test class. This might need a re-run if I have not got the syntax right.
Comment #14
jonathan1055 commentedNo tests were run because the class name is case-sensitive:
Drupal\Tests\scheduler\functional\SchedulerFieldsDisplayTestshould have been
Drupal\Tests\scheduler\Functional\SchedulerFieldsDisplayTestComment #16
jonathan1055 commentedGood. Just the single test class ran, and we got the required error as expected:
Here is the new test, with the added change from #7. As I mentioned in #10 I don't think this will solve the problem properly.
Comment #18
jonathan1055 commentedWe can't just bail out at the top if either of the fields are disabled. We can bail out if both are disabled, but need to cater for the case when one is and one is not.
Comment #19
jonathan1055 commentedThat's good. Now, just to check the complete test run.
If anyone would like to test this patch, you will need to download the latest dev, as there have been other recent changes. When done please mark the issue RTBC then I will commit it.
Jonathan
Comment #20
jonathan1055 commented... and without the coding standards warnings
Comment #21
thallesWorks for me!
Comment #22
thallesComment #24
jonathan1055 commentedFixed and committed. Thanks everyone.
Comment #26
jonathan1055 commentedI had a request from a user who is running Scheduler 1.0 (not the dev version) and would like to apply this fix. So here is a modified patch which applies to 8.x-1.0. It just fixes scheduler.module, there was no need to add the new test to this patch.