Issue #3097473 by kim.pepper: Remove all @deprecated code in the settings_tray module
parent
41da880d4f
commit
9bc961ab9b
|
@ -7,10 +7,3 @@ entity.block.settings_tray_form:
|
|||
_permission: 'administer blocks'
|
||||
_access_block_plugin_has_settings_tray_form: 'TRUE'
|
||||
_access_block_has_overrides_settings_tray_form: 'TRUE'
|
||||
|
||||
# Deprecated.
|
||||
# @see entity.block.settings_tray_form
|
||||
# @see \Drupal\settings_tray\RouteProcessor\BlockEntityOffCanvasFormRouteProcessorBC
|
||||
# @todo Remove in Drupal 9.0.0.
|
||||
entity.block.off_canvas_form:
|
||||
path: ''
|
||||
|
|
|
@ -7,12 +7,3 @@ services:
|
|||
class: Drupal\settings_tray\Access\BlockPluginHasSettingsTrayFormAccessCheck
|
||||
tags:
|
||||
- { name: access_check, applies_to: _access_block_plugin_has_settings_tray_form }
|
||||
|
||||
# BC layers.
|
||||
# @todo Remove in Drupal 9.0.0.
|
||||
settings_tray.route_processor_off_canvas_form_bc:
|
||||
class: \Drupal\settings_tray\RouteProcessor\BlockEntityOffCanvasFormRouteProcessorBC
|
||||
arguments: ['@router.route_provider']
|
||||
public: false
|
||||
tags:
|
||||
- { name: route_processor_outbound }
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\settings_tray\RouteProcessor;
|
||||
|
||||
use Drupal\Core\Render\BubbleableMetadata;
|
||||
use Drupal\Core\RouteProcessor\OutboundRouteProcessorInterface;
|
||||
use Drupal\Core\Routing\RouteProviderInterface;
|
||||
use Symfony\Component\Routing\Route;
|
||||
|
||||
/**
|
||||
* Processes the Block entity off-canvas form BC route.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class BlockEntityOffCanvasFormRouteProcessorBC implements OutboundRouteProcessorInterface {
|
||||
|
||||
/**
|
||||
* The route provider.
|
||||
*
|
||||
* @var \Drupal\Core\Routing\RouteProviderInterface
|
||||
*/
|
||||
protected $routeProvider;
|
||||
|
||||
/**
|
||||
* Constructs a BlockEntityOffCanvasFormRouteProcessorBC object.
|
||||
*
|
||||
* @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
|
||||
* The route provider.
|
||||
*/
|
||||
public function __construct(RouteProviderInterface $route_provider) {
|
||||
$this->routeProvider = $route_provider;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processOutbound($route_name, Route $route, array &$parameters, BubbleableMetadata $bubbleable_metadata = NULL) {
|
||||
if ($route_name === 'entity.block.off_canvas_form') {
|
||||
$redirected_route_name = 'entity.block.settings_tray_form';
|
||||
@trigger_error(sprintf("The '%s' route is deprecated since version 8.5.x and will be removed in 9.0.0. Use the '%s' route instead.", $route_name, $redirected_route_name), E_USER_DEPRECATED);
|
||||
static::overwriteRoute($route, $this->routeProvider->getRouteByName($redirected_route_name));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrites one route's metadata with the other's.
|
||||
*
|
||||
* @param \Symfony\Component\Routing\Route $target_route
|
||||
* The route whose metadata to overwrite.
|
||||
* @param \Symfony\Component\Routing\Route $source_route
|
||||
* The route whose metadata to read from.
|
||||
*
|
||||
* @see \Symfony\Component\Routing\Route
|
||||
*/
|
||||
protected static function overwriteRoute(Route $target_route, Route $source_route) {
|
||||
$target_route->setPath($source_route->getPath());
|
||||
$target_route->setDefaults($source_route->getDefaults());
|
||||
$target_route->setRequirements($source_route->getRequirements());
|
||||
$target_route->setOptions($source_route->getOptions());
|
||||
$target_route->setHost($source_route->getHost());
|
||||
$target_route->setSchemes($source_route->getSchemes());
|
||||
$target_route->setMethods($source_route->getMethods());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\settings_tray\Kernel;
|
||||
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
use Drupal\Tests\block\Traits\BlockCreationTrait;
|
||||
|
||||
/**
|
||||
* Tests Settings Tray BC routes.
|
||||
*
|
||||
* @group settings_tray
|
||||
* @group legacy
|
||||
*/
|
||||
class BcRoutesTest extends KernelTestBase {
|
||||
|
||||
use BlockCreationTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $modules = [
|
||||
'block',
|
||||
'settings_tray',
|
||||
'system',
|
||||
];
|
||||
|
||||
/**
|
||||
* @expectedDeprecation The 'entity.block.off_canvas_form' route is deprecated since version 8.5.x and will be removed in 9.0.0. Use the 'entity.block.settings_tray_form' route instead.
|
||||
*/
|
||||
public function testOffCanvasFormRouteBc() {
|
||||
$block = $this->placeBlock('system_powered_by_block');
|
||||
$url_for_current_route = Url::fromRoute('entity.block.settings_tray_form', ['block' => $block->id()])->toString(TRUE)->getGeneratedUrl();
|
||||
$url_for_bc_route = Url::fromRoute('entity.block.off_canvas_form', ['block' => $block->id()])->toString(TRUE)->getGeneratedUrl();
|
||||
$this->assertSame($url_for_current_route, $url_for_bc_route);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue