Commit 10057921 authored by Jonathan Smith's avatar Jonathan Smith
Browse files

Issue #3037483 by jonathan1055, bkosborne, Tess Bakker: Do not give warning...

Issue #3037483 by jonathan1055, bkosborne, Tess Bakker: Do not give warning for wrong widget if it is provided by a third-party module
parent e7eedb76
Loading
Loading
Loading
Loading
+5 −3
Changes for scheduler.module: 5 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -253,8 +253,10 @@ function _scheduler_entity_form_alter(&$form, FormStateInterface $form_state, $f
    $form['unpublish_on']['widget'][0]['value']['#required'] = FALSE;
  }

  // Check which widget type is set for the scheduler fields, and give a warning
  // if the wrong one has been set and provide a hint and link to fix it.
  // Check which widget is set for the scheduler fields, and give a warning and
  // provide a hint and link for how to fix it. Allow third-party modules to
  // provide their own custom widget, we are only interested in checking that it
  // has not reverted back to the core 'datetime_timestamp' widget.
  $pluginDefinitions = $display->get('pluginManager')->getDefinitions();
  $fields_to_check = [];
  if ($publishing_enabled && $publishing_displayed) {
@@ -266,7 +268,7 @@ function _scheduler_entity_form_alter(&$form, FormStateInterface $form_state, $f
  $correct_widget_id = 'datetime_timestamp_no_default';
  foreach ($fields_to_check as $field) {
    $actual_widget_id = $display->getComponent($field)['type'];
    if ($actual_widget_id != $correct_widget_id) {
    if ($actual_widget_id == 'datetime_timestamp') {
      $link = \Drupal::moduleHandler()->moduleExists('field_ui') ?
        Url::fromRoute("entity.entity_form_display.$entityTypeId.default", ["{$entityTypeId}_type" => $entity->bundle()])->toString()
        : '#';