Verified Commit f4744069 authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3375850 by omkar.podey, hooroomoo, smustgrave, narendraR, tedbow:...

Issue #3375850 by omkar.podey, hooroomoo, smustgrave, narendraR, tedbow: Broken Breadcrumb on Appearance tab
parent cd03ce14
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -5,9 +5,13 @@
use Drupal\Core\Batch\BatchBuilder;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Render\RendererInterface;
use Drupal\Core\Routing\PathChangedHelper;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\update\UpdateFetcherInterface;
use Drupal\update\UpdateManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;

/**
 * Controller routines for update routes.
@@ -97,4 +101,34 @@ public function updateStatusManually() {
    return batch_process('admin/reports/updates');
  }

  /**
   * Provides a redirect to update page.
   *
   * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
   *   A route match object, used for the route name and the parameters.
   * @param \Symfony\Component\HttpFoundation\Request $request
   *   The current request object.
   *
   * @return \Symfony\Component\HttpFoundation\RedirectResponse
   *   Returns redirect.
   *
   * @deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use
   *   /admin/appearance/update directly instead of /admin/theme/update.
   *
   * @see https://www.drupal.org/node/3375850
   */
  public function updateRedirect(RouteMatchInterface $route_match, Request $request): RedirectResponse {
    @trigger_error('The path /admin/theme/update is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use /admin/appearance/update. See https://www.drupal.org/node/3382805', E_USER_DEPRECATED);
    $helper = new PathChangedHelper($route_match, $request);
    $params = [
      '%old_path' => $helper->oldPath(),
      '%new_path' => $helper->newPath(),
      '%change_record' => 'https://www.drupal.org/node/3382805',
    ];
    $warning_message = $this->t('You have been redirected from %old_path. Update links, shortcuts, and bookmarks to use %new_path.', $params);
    $this->messenger()->addWarning($warning_message);
    $this->getLogger('update')->warning('A user was redirected from %old_path to %new_path. This redirect will be removed in a future version of Drupal. Update links, shortcuts, and bookmarks to use %new_path. See %change_record for more information.', $params);
    return $helper->redirect();
  }

}
+11 −0
Original line number Diff line number Diff line
@@ -326,4 +326,15 @@ private function checkTableHeaders($table_locator, array $expected_headers) {
    }
  }

  /**
   * Tests the deprecation warnings.
   *
   * @group legacy
   */
  public function testDeprecationWarning() {
    $this->drupalGet('admin/theme/update');
    $this->expectDeprecation('The path /admin/theme/update is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use /admin/appearance/update. See https://www.drupal.org/node/3382805');
    $this->assertSession()->statusMessageContains("You have been redirected from admin/theme/update. Update links, shortcuts, and bookmarks to use admin/appearance/update.", 'warning');
  }

}
+14 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ update.theme_install:
    _access_update_manager: 'TRUE'

update.theme_update:
  path: '/admin/theme/update'
  path: '/admin/appearance/update'
  defaults:
    _form: '\Drupal\update\Form\UpdateManagerUpdate'
    _title: 'Update'
@@ -77,6 +77,19 @@ update.theme_update:
    _permission: 'administer software updates'
    _access_update_manager: 'TRUE'

# @todo Deprecate this route once
#   https://www.drupal.org/project/drupal/issues/3159210 is fixed, or remove
#   it in Drupal 11.
# @see https://www.drupal.org/node/3375850
update.theme_update.bc:
  path: '/admin/theme/update'
  defaults:
    _title: 'Update'
    _controller: '\Drupal\update\Controller\UpdateController::updateRedirect'
  requirements:
    _permission: 'administer software updates'
    _access_update_manager: 'TRUE'

update.confirmation_page:
  path: '/admin/update/ready'
  defaults: