Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When adding scheduler options for publishing and unpublishing nodes the options never get saved.
I looked at trying to fix this but need some guidance. I saw that the path module in core uses a widget, is this the right route to go down?
Comment | File | Size | Author |
---|---|---|---|
#7 | scheduler_options_not_saving-2487303-7.patch | 2.46 KB | joekers |
#2 | scheduler_options_not-2487303-2.patch | 1.87 KB | joekers |
Comments
Comment #1
pfrenssenYou can find the code that was originally handling this is in
scheduler_node_validate()
. In Drupal 8hook_node_validate()
was removed. This is the change record: hook_node_validate() and hook_node_submit() have been removed.Seems like we need to implement some validation constraints!
Comment #2
joekersThanks for the pointer in your comment :) I haven't added any validation constraints as I think it's covered in other issues.
Comment #3
joekersComment #4
pfrenssenLooking very good. When testing it out I get a fatal error when viewing the node, but that's a different issue, I'll make a follow-up about it.
I would move this out of
scheduler.edit.inc
and intoscheduler.module
. The edit page is only included when an actual form alter takes place and might not be included when a cached form is reused. I can imagine that this would break in special cases such as multistep forms, inline entity forms etc.Ah so there were some calls left to
variable_get()
? Nice catch!This looks strange to me but it works and I could not find a better way to do it.
$node->getEntityType()
returns the definition instead of the entity, so that's not the right solution.I guess it's fine for now.
So the only thing that needs to be done is moving the entity builder function to
scheduler.module
.Comment #5
pfrenssenCreated followup issue for the fatal error: #2495011: Fatal error when viewing a scheduled node.
Comment #6
pfrenssenComment #7
joekers1. I've moved the scheduler_node_builder() to scheduler.module :)
2. Yeah I think there's still some more though but they don't seem to be causing any errors with anything I've been updating.
3. I thought so too but I couldn't find another way.
Comment #8
pfrenssenThanks a lot! Merged into 8.x-1.x.