Issue #3062281 by rpsu, tedbow, xjm, catch, acbramley, tim.plunkett, larowlan, Gábor Hojtsy, mikelutz, Berdir: Deprecate block_place module for removal in Drupal 9

merge-requests/64/head
catch 2019-11-08 10:54:50 +00:00
parent 0a7bb284bc
commit 9558e92739
32 changed files with 387 additions and 2 deletions

View File

@ -1,6 +1,6 @@
name: Place Blocks
type: module
description: 'Allow administrators to place blocks from any Drupal page'
description: 'Allow administrators to place blocks from any Drupal page. This module is deprecated in Drupal 8.8.0 and will be removed in Drupal 9.0.0. See the change record for a list of alternatives. See https://www.drupal.org/node/3081957.'
package: Core (Experimental)
version: VERSION
core: 8.x

View File

@ -0,0 +1,34 @@
<?php
/**
* @file
* Contains install and update functions for Place Blocks.
*/
/**
* Implements hook_requirements().
*/
function block_place_requirements($phase) {
$requirements = [];
// Notify about the module being deprecated.
if ($phase == 'runtime') {
$requirements['block_place'] = [
'title' => t('Place blocks'),
'severity' => REQUIREMENT_INFO,
'description' => t('Place Blocks (Core, Experimental) is deprecated in Drupal 8.8.0 and will be removed in Drupal 9.0.0. See <a href=":change-record">See the change record for a list of alternatives</a>.', [
':change-record' => 'https://www.drupal.org/node/3081957',
]),
];
}
return $requirements;
}
/**
* Implements hook_install().
*/
function block_place_install() {
\Drupal::messenger()->addWarning(t('Place Blocks (Core, Experimental) is deprecated in Drupal 8.8.0 and will be removed in Drupal 9.0.0. See the change record for a list of alternatives. See <a href=":change-record">the change record</a>.', [
':change-record' => 'https://www.drupal.org/node/3081957',
]));
}

View File

@ -3,9 +3,11 @@ drupal.block_place:
css:
theme:
css/block-place.css: {}
deprecated: The "%library_id%" asset is deprecated in drupal:8.8.0 and will be removed in drupal:9.0.0. See the change record for a list of alternatives. See https://www.drupal.org/node/3081957.
drupal.block_place.icons:
version: VERSION
css:
theme:
css/block-place.icons.theme.css: {}
deprecated: The "%library_id%" asset is deprecated in drupal:8.8.0 and will be removed in drupal:9.0.0. See the change record for a list of alternatives. See https://www.drupal.org/node/3081957.

View File

@ -3,11 +3,18 @@
/**
* @file
* Controls the placement of blocks from all pages.
*
* @deprecated in drupal:8.8.0 and will be removed from drupal:9.0.0. See the
* change record for a list of alternatives.
*
* @see https://www.drupal.org/node/3081957
*/
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
@trigger_error('The Place Blocks module is deprecated in drupal:8.8.0 and will be removed from drupal:9.0.0. See the change record for a list of alternatives. See https://www.drupal.org/node/3081957.', E_USER_DEPRECATED);
/**
* Implements hook_help().
*/
@ -15,6 +22,9 @@ function block_place_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.block_place':
$output = '<h3>' . t('About') . '</h3>';
$output .= '<p><strong>' . t('Place Blocks (Core, Experimental) is deprecated in Drupal 8.8.0 and will be removed in Drupal 9.0.0. See the change record for a list of alternatives. See <a href=":change-record">the change record</a>.', [
':change-record' => 'https://www.drupal.org/node/3081957',
]) . '</strong></p>';
$output .= '<p>' . t('The Place Blocks module allows you to place blocks from every page. For more information, see the <a href=":blocks-documentation">online documentation for the Place Blocks module</a>.', [':blocks-documentation' => 'https://www.drupal.org/documentation/modules/block_place/']) . '</p>';
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<p>' . t('Block placement is specific to each theme on your site. This module allows you to place blocks in the context of your content pages.') . '</p>';

View File

@ -4,3 +4,4 @@ services:
arguments: ['@request_stack', '@current_user']
tags:
- { name: event_subscriber }
deprecated: The "%service_id%" service is deprecated in drupal:8.8.0 and will be removed in drupal:9.0.0. See the change record for a list of alternatives. See https://www.drupal.org/node/3081957.

View File

@ -18,6 +18,11 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* id = "block_place_page",
* admin_label = @Translation("Page with blocks and place block buttons")
* )
*
* @deprecated in drupal:8.8.0 and will be removed from drupal:9.0.0. See the
* change record for a list of alternatives.
*
* @see https://www.drupal.org/node/3081957
*/
class PlaceBlockPageVariant extends BlockPageVariant {
@ -56,6 +61,8 @@ class PlaceBlockPageVariant extends BlockPageVariant {
* The redirect destination.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, BlockRepositoryInterface $block_repository, EntityViewBuilderInterface $block_view_builder, array $block_list_cache_tags, ThemeManagerInterface $theme_manager, RedirectDestinationInterface $redirect_destination) {
@trigger_error('The ' . __NAMESPACE__ . '\PlaceBlockPageVariant is deprecated in drupal:8.8.0 and will be removed from drupal:9.0.0. See the change record for a list of alternatives. See https://www.drupal.org/node/3081957.', E_USER_DEPRECATED);
parent::__construct($configuration, $plugin_id, $plugin_definition, $block_repository, $block_view_builder, $block_list_cache_tags);
$this->themeManager = $theme_manager;

View File

@ -9,6 +9,7 @@ use Drupal\Tests\BrowserTestBase;
* Tests the placing a block.
*
* @group block_place
* @group legacy
*/
class BlockPlaceTest extends BrowserTestBase {

View File

@ -6,6 +6,7 @@ use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Extension\ExtensionDiscovery;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\Tests\DeprecatedModulesTestTrait;
/**
* Tests the field type manager.
@ -14,6 +15,8 @@ use Drupal\entity_test\Entity\EntityTest;
*/
class FieldTypePluginManagerTest extends FieldKernelTestBase {
use DeprecatedModulesTestTrait;
/**
* Tests the default settings convenience methods.
*/

View File

@ -0,0 +1,20 @@
<?php
namespace Drupal\Tests\field\Kernel;
/**
* Extends FieldTypePluginManagerTest to test with deprecated modules.
*
* @see \Drupal\Tests\DeprecatedModulesTestTrait::removeDeprecatedModules()
*
* @group field
* @group legacy
*/
class LegacyFieldTypePluginManagerTest extends FieldTypePluginManagerTest {
/**
* {@inheritdoc}
*/
protected $excludeDeprecated = FALSE;
}

View File

@ -4,6 +4,7 @@ namespace Drupal\Tests\help_topics\Functional;
use Drupal\Tests\BrowserTestBase;
use Drupal\help_topics\HelpTopicDiscovery;
use Drupal\Tests\DeprecatedModulesTestTrait;
use PHPUnit\Framework\ExpectationFailedException;
/**
@ -19,6 +20,8 @@ use PHPUnit\Framework\ExpectationFailedException;
*/
class HelpTopicsSyntaxTest extends BrowserTestBase {
use DeprecatedModulesTestTrait;
/**
* {@inheritdoc}
*/
@ -36,7 +39,9 @@ class HelpTopicsSyntaxTest extends BrowserTestBase {
// Enable all modules and themes, so that all routes mentioned in topics
// will be defined.
$module_directories = $this->listDirectories('module');
\Drupal::service('module_installer')->install(array_keys($module_directories));
$modules_to_install = array_keys($module_directories);
$modules_to_install = $this->removeDeprecatedModules($modules_to_install);
\Drupal::service('module_installer')->install($modules_to_install);
$theme_directories = $this->listDirectories('theme');
\Drupal::service('theme_installer')->install(array_keys($theme_directories));

View File

@ -0,0 +1,20 @@
<?php
namespace Drupal\Tests\help_topics\Functional;
/**
* Extends HelpTopicsSyntaxTest to test with deprecated modules.
*
* @see \Drupal\Tests\DeprecatedModulesTestTrait::removeDeprecatedModules()
*
* @group help_topics
* @group legacy
*/
class LegacyHelpTopicsSyntaxTest extends HelpTopicsSyntaxTest {
/**
* {@inheritdoc}
*/
protected $excludeDeprecated = FALSE;
}

View File

@ -0,0 +1,20 @@
<?php
namespace Drupal\Tests\migrate\Kernel\Plugin;
/**
* Extends MigrationProvidersExistTest to test with deprecated modules.
*
* @see \Drupal\Tests\DeprecatedModulesTestTrait::removeDeprecatedModules()
*
* @group migrate_drupal_ui
* @group legacy
*/
class LegacyMigrationProvidersExistTest extends MigrationProvidersExistTest {
/**
* {@inheritdoc}
*/
protected $excludeDeprecated = FALSE;
}

View File

@ -5,6 +5,7 @@ namespace Drupal\Tests\migrate\Kernel\Plugin;
use Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait;
use Drupal\migrate\Plugin\Exception\BadPluginDefinitionException;
use Drupal\migrate_drupal\Plugin\MigrateFieldPluginManager;
use Drupal\Tests\DeprecatedModulesTestTrait;
use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase;
/**
@ -14,6 +15,7 @@ use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase;
*/
class MigrationProvidersExistTest extends MigrateDrupalTestBase {
use DeprecatedModulesTestTrait;
use FileSystemModuleDiscoveryDataProviderTrait;
/**

View File

@ -0,0 +1,20 @@
<?php
namespace Drupal\Tests\migrate_drupal\Kernel;
/**
* Extends StateFileExists to test with deprecated modules.
*
* @see \Drupal\Tests\DeprecatedModulesTestTrait::removeDeprecatedModules()
*
* @group migrate_drupal
* @group legacy
*/
class LegacyStateFileExists extends StateFileExists {
/**
* {@inheritdoc}
*/
protected $excludeDeprecated = FALSE;
}

View File

@ -13,6 +13,7 @@ use Drupal\path\Plugin\migrate\destination\UrlAlias;
use Drupal\shortcut\Plugin\migrate\destination\ShortcutSetUsers;
use Drupal\statistics\Plugin\migrate\destination\NodeCounter;
use Drupal\system\Plugin\migrate\destination\d7\ThemeSettings;
use Drupal\Tests\DeprecatedModulesTestTrait;
use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase;
use Drupal\Tests\migrate_drupal\Traits\CreateMigrationsTrait;
use Drupal\user\Plugin\migrate\destination\UserData;
@ -26,6 +27,7 @@ class DestinationCategoryTest extends MigrateDrupalTestBase {
use FileSystemModuleDiscoveryDataProviderTrait;
use CreateMigrationsTrait;
use DeprecatedModulesTestTrait;
/**
* The migration plugin manager.
@ -40,6 +42,7 @@ class DestinationCategoryTest extends MigrateDrupalTestBase {
protected function setUp() {
// Enable all modules.
self::$modules = array_keys($this->coreModuleListDataProvider());
self::$modules = $this->removeDeprecatedModules(self::$modules);
parent::setUp();
$this->migrationManager = \Drupal::service('plugin.manager.migration');
}

View File

@ -0,0 +1,20 @@
<?php
namespace Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate;
/**
* Extends DestinationCategoryTest to test with deprecated modules.
*
* @see \Drupal\Tests\DeprecatedModulesTestTrait::removeDeprecatedModules()
*
* @group migrate_drupal
* @group legacy
*/
class LegacyDestinationCategoryTest extends DestinationCategoryTest {
/**
* {@inheritdoc}
*/
protected $excludeDeprecated = FALSE;
}

View File

@ -5,6 +5,7 @@ namespace Drupal\Tests\migrate_drupal\Kernel;
use Drupal\Component\Discovery\YamlDiscovery;
use Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait;
use Drupal\migrate_drupal\MigrationConfigurationTrait;
use Drupal\Tests\DeprecatedModulesTestTrait;
/**
* Tests that core modules have a migrate_drupal.yml file as needed.
@ -18,6 +19,7 @@ use Drupal\migrate_drupal\MigrationConfigurationTrait;
*/
class StateFileExists extends MigrateDrupalTestBase {
use DeprecatedModulesTestTrait;
use FileSystemModuleDiscoveryDataProviderTrait;
use MigrationConfigurationTrait;

View File

@ -0,0 +1,20 @@
<?php
namespace Drupal\Tests\migrate_drupal\Kernel\d6;
/**
* Extends MigrateDrupal6AuditIdsTest to test with deprecated modules.
*
* @see \Drupal\Tests\DeprecatedModulesTestTrait::removeDeprecatedModules()
*
* @group migrate_drupal
* @group legacy
*/
class LegacyMigrateDrupal6AuditIdsTest extends MigrateDrupal6AuditIdsTest {
/**
* {@inheritdoc}
*/
protected $excludeDeprecated = FALSE;
}

View File

@ -0,0 +1,21 @@
<?php
namespace Drupal\Tests\migrate_drupal\Kernel\d6;
/**
* Extends Drupal\Tests\migrate_drupal\Kernel\d6\MigrationProcessTest to test
* with deprecated modules.
*
* @see \Drupal\Tests\DeprecatedModulesTestTrait::removeDeprecatedModules()
*
* @group migrate_drupal
* @group legacy
*/
class LegacyMigrationProcessTest extends MigrationProcessTest {
/**
* {@inheritdoc}
*/
protected $excludeDeprecated = FALSE;
}

View File

@ -0,0 +1,21 @@
<?php
namespace Drupal\Tests\migrate_drupal\Kernel\d6;
/**
* Extends Drupal\Tests\migrate_drupal\Kernel\d6\ValidateMigrationStateTest
* to test with deprecated modules.
*
* @see \Drupal\Tests\DeprecatedModulesTestTrait::removeDeprecatedModules()
*
* @group migrate_drupal
* @group legacy
*/
class LegacyValidateMigrationStateTest extends ValidateMigrationStateTest {
/**
* {@inheritdoc}
*/
protected $excludeDeprecated = FALSE;
}

View File

@ -8,6 +8,7 @@ use Drupal\migrate\Audit\IdAuditor;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait;
use Drupal\Tests\DeprecatedModulesTestTrait;
use Drupal\Tests\migrate_drupal\Traits\CreateTestContentEntitiesTrait;
/**
@ -20,6 +21,7 @@ class MigrateDrupal6AuditIdsTest extends MigrateDrupal6TestBase {
use FileSystemModuleDiscoveryDataProviderTrait;
use CreateTestContentEntitiesTrait;
use ContentModerationTestTrait;
use DeprecatedModulesTestTrait;
/**
* {@inheritdoc}
@ -27,6 +29,7 @@ class MigrateDrupal6AuditIdsTest extends MigrateDrupal6TestBase {
protected function setUp() {
// Enable all modules.
self::$modules = array_keys($this->coreModuleListDataProvider());
self::$modules = $this->removeDeprecatedModules(self::$modules);
parent::setUp();
// Install required entity schemas.

View File

@ -3,6 +3,7 @@
namespace Drupal\Tests\migrate_drupal\Kernel\d6;
use Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait;
use Drupal\Tests\DeprecatedModulesTestTrait;
/**
* Tests the getProcess() method of all Drupal 6 migrations.
@ -10,6 +11,8 @@ use Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait;
* @group migrate_drupal
*/
class MigrationProcessTest extends MigrateDrupal6TestBase {
use DeprecatedModulesTestTrait;
use FileSystemModuleDiscoveryDataProviderTrait;
/**
@ -17,6 +20,7 @@ class MigrationProcessTest extends MigrateDrupal6TestBase {
*/
public function setUp() {
self::$modules = array_keys($this->coreModuleListDataProvider());
self::$modules = $this->removeDeprecatedModules(self::$modules);
parent::setUp();
}

View File

@ -2,6 +2,7 @@
namespace Drupal\Tests\migrate_drupal\Kernel\d6;
use Drupal\Tests\DeprecatedModulesTestTrait;
use Drupal\Tests\migrate_drupal\Traits\ValidateMigrationStateTestTrait;
/**
@ -11,6 +12,7 @@ use Drupal\Tests\migrate_drupal\Traits\ValidateMigrationStateTestTrait;
*/
class ValidateMigrationStateTest extends MigrateDrupal6TestBase {
use DeprecatedModulesTestTrait;
use ValidateMigrationStateTestTrait;
/**

View File

@ -0,0 +1,20 @@
<?php
namespace Drupal\Tests\migrate_drupal\Kernel\d7;
/**
* Extends MigrateDrupal7AuditIdsTest to test with deprecated modules.
*
* @see \Drupal\Tests\DeprecatedModulesTestTrait::removeDeprecatedModules()
*
* @group migrate_drupal
* @group legacy
*/
class LegacyMigrateDrupal7AuditIdsTest extends MigrateDrupal7AuditIdsTest {
/**
* {@inheritdoc}
*/
protected $excludeDeprecated = FALSE;
}

View File

@ -0,0 +1,21 @@
<?php
namespace Drupal\Tests\migrate_drupal\Kernel\d7;
/**
* Extends Drupal\Tests\migrate_drupal\Kernel\d7\MigrationProcessTest to test
* with deprecated modules.
*
* @see \Drupal\Tests\DeprecatedModulesTestTrait::removeDeprecatedModules()
*
* @group migrate_drupal
* @group legacy
*/
class LegacyMigrationProcessTest extends MigrationProcessTest {
/**
* {@inheritdoc}
*/
protected $excludeDeprecated = FALSE;
}

View File

@ -0,0 +1,21 @@
<?php
namespace Drupal\Tests\migrate_drupal\Kernel\d7;
/**
* Extends Drupal\Tests\migrate_drupal\Kernel\d7\ValidateMigrationStateTest
* to test with deprecated modules.
*
* @see \Drupal\Tests\DeprecatedModulesTestTrait::removeDeprecatedModules()
*
* @group migrate_drupal
* @group legacy
*/
class LegacyValidateMigrationStateTest extends ValidateMigrationStateTest {
/**
* {@inheritdoc}
*/
protected $excludeDeprecated = FALSE;
}

View File

@ -8,6 +8,7 @@ use Drupal\migrate\Audit\IdAuditor;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait;
use Drupal\Tests\DeprecatedModulesTestTrait;
use Drupal\Tests\migrate_drupal\Traits\CreateTestContentEntitiesTrait;
/**
@ -20,6 +21,7 @@ class MigrateDrupal7AuditIdsTest extends MigrateDrupal7TestBase {
use FileSystemModuleDiscoveryDataProviderTrait;
use CreateTestContentEntitiesTrait;
use ContentModerationTestTrait;
use DeprecatedModulesTestTrait;
/**
* {@inheritdoc}
@ -27,6 +29,7 @@ class MigrateDrupal7AuditIdsTest extends MigrateDrupal7TestBase {
protected function setUp() {
// Enable all modules.
self::$modules = array_keys($this->coreModuleListDataProvider());
self::$modules = $this->removeDeprecatedModules(self::$modules);
parent::setUp();
// Install required entity schemas.

View File

@ -3,6 +3,7 @@
namespace Drupal\Tests\migrate_drupal\Kernel\d7;
use Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait;
use Drupal\Tests\DeprecatedModulesTestTrait;
/**
* Tests the getProcess() method of all Drupal 7 migrations.
@ -10,6 +11,8 @@ use Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait;
* @group migrate_drupal
*/
class MigrationProcessTest extends MigrateDrupal7TestBase {
use DeprecatedModulesTestTrait;
use FileSystemModuleDiscoveryDataProviderTrait;
/**
@ -17,6 +20,7 @@ class MigrationProcessTest extends MigrateDrupal7TestBase {
*/
public function setUp() {
self::$modules = array_keys($this->coreModuleListDataProvider());
self::$modules = $this->removeDeprecatedModules(self::$modules);
parent::setUp();
}

View File

@ -2,6 +2,7 @@
namespace Drupal\Tests\migrate_drupal\Kernel\d7;
use Drupal\Tests\DeprecatedModulesTestTrait;
use Drupal\Tests\migrate_drupal\Traits\ValidateMigrationStateTestTrait;
/**
@ -11,6 +12,7 @@ use Drupal\Tests\migrate_drupal\Traits\ValidateMigrationStateTestTrait;
*/
class ValidateMigrationStateTest extends MigrateDrupal7TestBase {
use DeprecatedModulesTestTrait;
use ValidateMigrationStateTestTrait;
/**

View File

@ -0,0 +1,20 @@
<?php
namespace Drupal\Tests\migrate_drupal_ui\Kernel;
/**
* Extends MigrationLabelExistTest to test with deprecated modules.
*
* @see \Drupal\Tests\DeprecatedModulesTestTrait::removeDeprecatedModules()
*
* @group migrate_drupal_ui
* @group legacy
*/
class LegacyMigrationLabelExistTest extends MigrationLabelExistTest {
/**
* {@inheritdoc}
*/
protected $excludeDeprecated = FALSE;
}

View File

@ -4,6 +4,7 @@ namespace Drupal\Tests\migrate_drupal_ui\Kernel;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait;
use Drupal\Tests\DeprecatedModulesTestTrait;
use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase;
/**
@ -13,6 +14,7 @@ use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase;
*/
class MigrationLabelExistTest extends MigrateDrupalTestBase {
use DeprecatedModulesTestTrait;
use FileSystemModuleDiscoveryDataProviderTrait;
/**

View File

@ -0,0 +1,51 @@
<?php
namespace Drupal\Tests;
/**
* Provides methods remove deprecated modules from tests.
*/
trait DeprecatedModulesTestTrait {
/**
* List of deprecated modules names to not be enabled for tests.
*
* @var array
*/
protected $deprecatedModules = ['block_place'];
/**
* Flag to exclude deprecated modules from the tests.
*
* Legacy*Test -test may set this to FALSE to include also deprecated
* modules for tests.
*
* @var bool
*/
protected $excludeDeprecated = TRUE;
/**
* Removes deprecated modules from the provided modules.list.
*
* @param array $modules
* Array of modules names.
*
* @return array
* The filtered $modules array.
*/
protected function removeDeprecatedModules(array $modules) {
return $this->excludeDeprecated ? array_diff($modules, $this->deprecatedModules) : $modules;
}
/**
* Overrides \Drupal\KernelTests\KernelTestBase::enableModules().
*
* For kernel tests this override will ensure that deprecated modules are not
* enabled if \Drupal\Tests\DeprecatedModulesTestTrait::$excludeDeprecated
* is set to true.
*/
protected function enableModules(array $modules) {
parent::enableModules($this->removeDeprecatedModules($modules));
}
}