You are here

function automatic_updates_form_update_manager_update_form_alter in Automatic Updates 8.2

Implements hook_form_FORM_ID_alter() for 'update_manager_update_form'.

File

./automatic_updates.module, line 70
Contains hook implementations for Automatic Updates.

Code

function automatic_updates_form_update_manager_update_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  // Remove current message that core updates are not supported with a link to
  // use this modules form.
  if (isset($form['manual_updates']['#rows']['drupal']['data']['title'])) {
    $current_route = \Drupal::routeMatch()
      ->getRouteName();
    if ($current_route === 'update.module_update') {
      $redirect_route = 'automatic_updates.module_update';
    }
    elseif ($current_route === 'update.report_update') {
      $redirect_route = 'automatic_updates.report_update';
    }
    if (!empty($redirect_route)) {
      $core_updates_message = t('<h2>Core updates required</h2>Drupal core updates are supported by the enabled <a href="@url">Automatic Updates module</a>', [
        '@url' => Url::fromRoute($redirect_route)
          ->toString(),
      ]);
      $form['manual_updates']['#prefix'] = $core_updates_message;
    }
  }
}