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:

  1. Clean install of core 8.7
  2. Enable Content Moderation, Scheduler and SCMI modules
  3. Config - Workflows - Edit 'Editorial' - 'This workflow applies to content type' - select Article
  4. Enable Article content type for scheduled publishing
  5. In Article 'manage form display' disable both 'Publish On' and 'Publish State' fields
  6. In /admin/config/development/logging select 'All messages'
  7. Create Article content

Comments

jonathan1055 created an issue. See original summary.

jonathan1055’s picture

This change should also have test coverage.

iyyappan.govind’s picture

Hi Jonathan

Can you please help me with this issue to create the patch?

Thanks

jonathan1055’s picture

Status: Active » Needs review
StatusFileSize
new3.06 KB

Hi 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

iyyappan.govind’s picture

Hi 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

iyyappan.govind’s picture

Status: Needs review » Reviewed & tested by the community
jonathan1055’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs review

Thanks 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.

jonathan1055’s picture

Status: Needs review » Reviewed & tested by the community

Why does d.o. switch back the issue status? Stale form data? Setting back to RTBC

jonathan1055’s picture

Status: Reviewed & tested by the community » Fixed

Fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.