In #2798689: Scheduler integration with core Content moderation I added the code to call each implementation of hook_scheduler_hide_publish_on_field to check whether the publish_on field should be hidden in the scheduler node form.
// Invoke all implementations of hook_scheduler_hide_publish_on_field() and
// hook_scheduler_hide_unpublish_on_field() to allow other modules to hide the
// fields on the node edit form.
$hook = 'scheduler_hide_publish_on_field';
foreach (\Drupal::moduleHandler()->getImplementations($hook) as $module) {
$function = $module . '_' . $hook;
$publishing_enabled = $publishing_enabled && ($function($form, $form_state, $node) !== TRUE);
}
However in #3061630: Undefined index: publish_state when publish field is not present the hook implementation causes an error if the field is not in the form, i.e. already hidden. This should probably be fixed in Scheduler by only running the above foreach when $publishing_displayed is true.
Minimum steps to re-produce:
- Clean install of core 8.7
- Enable Content Moderation, Scheduler and SCMI modules
- Config - Workflows - Edit 'Editorial' - 'This workflow applies to content type' - select Article
- Enable Article content type for scheduled publishing
- In Article 'manage form display' disable both 'Publish On' and 'Publish State' fields
- In /admin/config/development/logging select 'All messages'
- Create Article content
Comments
Comment #2
jonathan1055 commentedThis change should also have test coverage.
Comment #3
iyyappan.govindHi Jonathan
Can you please help me with this issue to create the patch?
Thanks
Comment #4
jonathan1055 commentedHi iyyappan.govind,
Here is a patch for the code change. If you are getting this problem, please test with this patch and see if this fixes it.
In #2 I said that this would need new test coverage but there is no actual change in functionality, the fix just avoids the 'undefined index' warning. The existing API tests adequately cover this already.
Jonathan
Comment #5
iyyappan.govindHi jonathan1055,
This is patch is working fine.
Thanks for the patch. Can you release new version of module because I can see last release on Nov 2017? Thanks
Comment #6
iyyappan.govindComment #7
jonathan1055 commentedThanks for testing the patch, I will commit this later.
Yes, you can see on #3030243: Plan for Scheduler 8.x-1.1 release that this issue is the final blocker that needs to be fixed before the release of Scheduler 8.x-1.1, and I plan to to that today or tomorrow.
Comment #8
jonathan1055 commentedWhy does d.o. switch back the issue status? Stale form data? Setting back to RTBC
Comment #10
jonathan1055 commentedFixed.