Problem/Motivation

#2739075: [plan] Make Place Blocks module functionality part of the Block module (etc.) wanted to move the module into block module originally, but now Layout Builder superseded it. So we should figure out a way to deprecate the module and remove it so it in Drupal 9 is not in Drupal 9.0 anymore.

Proposed resolution

1. Figure out a way to deprecate a module. We don't yet have a process.
2. Deprecate this module.
3. Remove it in Drupal 9.

Remaining tasks

Do it.

User interface changes

Module will be deprecated, and removed in 9.0.x.

API changes

None.

Data model changes

None.

Release notes snippet

The Place Blocks module (already hidden in previous releases of Drupal core) has been deprecated and will be removed in Drupal 9.0.0. See the change record on the Place Blocks module for alternatives.

CommentFileSizeAuthor
#126 3062281-126.patch30.11 KBtedbow
#126 interdiff-124-126.txt639 bytestedbow
#124 3062281-124.patch29.83 KBtedbow
#124 interdiff-117-124.txt8.91 KBtedbow
#121 3062281-117-no-remove.patch34.27 KBtedbow
#121 interdiff.txt2.69 KBtedbow
#117 3062281-117.patch32.21 KBtedbow
#117 interdiff-113-117.txt2.18 KBtedbow
#116 3062281-116-test-for-fails-with-module-trigger.patch34.34 KBtedbow
#116 3062281-116-test-for-fails.patch34.06 KBtedbow
#116 interdiff-116.txt2.77 KBtedbow
#113 interdiff-109-112.txt937 bytesrpsu
#113 deprecate_place_block-3062281-112.patch31.93 KBrpsu
#109 interdiff-107-109.txt2.3 KBrpsu
#109 deprecate_place_block-3062281-109.patch31.93 KBrpsu
#107 interdiff-103-106.txt7.51 KBxjm
#107 deprecate_place_block-3062281-106.patch31.95 KBxjm
#103 interdiff-98-103.txt34.66 KBrpsu
#103 deprecate_place_block-3062281-103.patch31.97 KBrpsu
#98 interdiff-96-98.txt17.63 KBrpsu
#98 deprecate_place_block-3062281-98.patch35.15 KBrpsu
#96 interdiff-92-96.txt2.21 KBrpsu
#96 deprecate_place_block-3062281-96.patch37.55 KBrpsu
#92 interdiff-88-89.txt3.87 KBrpsu
#92 deprecate_place_block-3062281-89.patch38.67 KBrpsu
#90 interdiff-87-88.txt2.7 KBrpsu
#90 deprecate_place_block-3062281-88.patch39.49 KBrpsu
#87 interdiff-86-87.txt4.01 KBrpsu
#87 deprecate_place_block-3062281-87.patch39.23 KBrpsu
#86 interdiff-85-86.txt1.49 KBrpsu
#86 deprecate_place_block-3062281-86.patch39.07 KBrpsu
#85 interdiff-84-85.txt1.49 KBrpsu
#85 deprecate_place_block-3062281-85.patch38.78 KBrpsu
#84 interdiff-83-84.txt2.92 KBrpsu
#84 deprecate_place_block-3062281-84.patch38.5 KBrpsu
#83 interdiff-82-83.txt36.23 KBrpsu
#83 deprecate_place_block-3062281-83.patch38.56 KBrpsu
#82 deprecate_place_block-3062281-82.patch31.23 KBrpsu
#79 interdiff-78-80.txt11.52 KBrpsu
#79 deprecate_place_block-3062281-80.patch37.7 KBrpsu
#78 interdiff-76-78.txt1.75 KBrpsu
#78 deprecate_place_block-3062281-78.patch40.44 KBrpsu
#76 interdiff-74-76.txt23.61 KBrpsu
#76 deprecate_place_block-3062281-76.patch40.57 KBrpsu
#74 interdiff-71-74.txt11.37 KBrpsu
#74 deprecate_place_block-3062281-74.patch40.1 KBrpsu
#71 interdiff-68-71.txt1.28 KBrpsu
#71 deprecate_place_block-3062281-71.patch39.08 KBrpsu
#68 interdiff-64-68.txt33.51 KBrpsu
#68 deprecate_place_block-3062281-68.patch39.14 KBrpsu
#64 interdiff-49-64.txt23.84 KBrpsu
#64 deprecate_place_block-3062281-64.patch33.3 KBrpsu
#63 3062281-49-63-interdiff.txt9.14 KBcatch
#63 3062281-63.patch16.36 KBcatch
#49 interdiff-3062281-46-49.txt741 bytesacbramley
#49 3062281-49.patch18 KBacbramley
#46 interdiff-36-46.txt981 bytesrpsu
#46 deprecate_place_block-3062281-46.patch18.08 KBrpsu
#42 interdiff-36-41.txt616 bytesrpsu
#42 deprecate_place_block-3062281-42.patch759 bytesrpsu
#36 interdiff-32-36.txt1.93 KBrpsu
#36 deprecate_place_block-3062281-36.patch17.12 KBrpsu
#32 interdiff-29-31.txt10.59 KBrpsu
#32 deprecate_place_block-3062281-32.patch16.12 KBrpsu
#29 interdiff-27-29.txt470 bytesrpsu
#29 deprecate_place_block-3062281-29.patch13.59 KBrpsu
#27 interdiff-23-27.txt7.05 KBrpsu
#27 deprecate_place_block-3062281-27.patch13.14 KBrpsu
#23 deprecate_place_block-3062281-23.patch7.94 KBrpsu
#18 interdiff-17-18.txt2.77 KBrpsu
#18 deprecate_place_block-3062281-18.patch5.68 KBrpsu
#17 interdiff-2-17.txt8.64 KBrpsu
#16 deprecate_place_block-3062281-16.patch210.67 KBrpsu
#17 deprecate_place_block-3062281-17.patch4.56 KBrpsu
#4 deprecate_place_block-3062281-2.patch5.81 KBrpsu
#16 interdiff-2-16.txt215.54 KBrpsu

Comments

Gábor Hojtsy created an issue. See original summary.

xjm’s picture

Version: 9.x-dev » 8.8.x-dev

So the module is hidden from the UI, but there's no deprecation messages surfaced. I think in 8.8.x we should:

  1. Create a https://www.drupal.org/project/block_place contrib project from the 8.8.x codebase of the module. The project page should indicate that it has no further development and will not have any releases for Drupal 8 or 10, and recommend Layout Builder instead.
  2. Add a CR announcing the deprecation and recommending sites switch to Layout Builder, but indicating that the contrib project will be available as a fallback if needed.
  3. Add a status report info message that the module is deprecated and will be moved to contrib in Drupal 9. Recommend Layout builder.
  4. Add an install warning message as above.
  5. Mark all the PHP code, JS code, and libraries deprecated. I think that also means the module's own test suite will need to be marked legacy.
  6. Mention that the module is deprecated in its description, so sites that are installed see it on the modules page too.
  7. File and/or link a related issue to allow modules to be deprecated wholesale the way that libraries are. That's a should-have, but not a hard requirement IMO, since blasting deprecations all over the whole module should be sufficient to make sites fail Upgrade Status hard if they're using it.
  8. When 9.0.x opens, rm -rf the thing.
xjm’s picture

Issue tags: +Drupal 9
rpsu’s picture

Assigned: Unassigned » rpsu
StatusFileSize
new5.81 KB

Would this be enough for deprecating the module, or do the tests also be marked as deprecated?

rpsu’s picture

The namespace https://www.drupal.org/project/block_place was taken a few days ago (but git does not have any commits as of now), I've contacted the current module owner.

xjm’s picture

Status: Active » Needs review

This is a great start; thanks @rpsu!

I wonder if the person who took the namespace was also thinking to contribute here. We definitely need the namespace for a safe upgrade path for core.

xjm’s picture

Title: Deprecate and remove place_block module in Drupal 9 » Deprecate and remove block_place module in Drupal 9
Issue tags: +Needs change record

A few suggestions and next steps:

  1. For the deprecation messages, we should add a change record draft that documents the same thing in a little more detail, with instructions for sites or modules that depend on block_place. Then it gets simply added on with an @see after the @deprecated: https://www.drupal.org/core/deprecation#how
  2. Then we should add @trigger_error() inside the deprecated code (as described in the handbook page above). This will help sites and modules identify that deprecated code is being used at runtime or during test runs.
  3. Then, the @trigger_error() should start causing block_place tests to fail. We mark the tests as legacy tests to get them to pass again.
  4. We should also be able to deprecate the module's libraries, as described here: https://www.drupal.org/node/3064022
  5. And finally, just a docs update in the module's info.yml, hook_help(), and so on with the same messages.

Thanks so much for getting this issue rolling.

andypost’s picture

Status: Needs review » Needs work

I can't find policy about deprecation of modules but there's example in core's entity_reference module

+++ b/core/modules/block_place/src/Plugin/DisplayVariant/PlaceBlockPageVariant.php
@@ -80,6 +97,11 @@ public static function create(ContainerInterface $container, array $configuratio
    * {@inheritdoc}
+   *
+   * @deprecated in Drupal 8.8.x and will be removed before Drupal 9.0.0.

No need for that, the trigger_error should be added to start of file

xjm’s picture

Here are the references for classes: https://www.drupal.org/core/deprecation#how-classes
And for files of procedural code: https://www.drupal.org/core/deprecation#how-file

Thanks @andypost!

rpsu’s picture

I did not get any response yet to my direct contact of the current module owner, so I created an issue in the empty module's issue queue:
#3081451: Project namespace collision with core deprecation module

rpsu’s picture

I think it'd be good to wait for that module's maintainer to respond before writing the deprecation messages - I sort of hope we could state something like
'The Place blocks -module is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use of Layout builder is recommended, or using contrib module in https://www.drupal.org/project/block_place . See http://drupal.org/node/the-change-notice-nid

rpsu’s picture

https://git.drupalcode.org/project/block_place has now branch 9.x-1.x with the almost identical clone of what is currently in 8.8.x

rpsu’s picture

Status: Needs work » Needs review

Draft change record to be reviewed https://www.drupal.org/node/3081957

rpsu’s picture

Assigned: rpsu » Unassigned
rpsu’s picture

Issue tags: -Needs change record
rpsu’s picture

StatusFileSize
new210.67 KB
new215.54 KB

The method deprecations are now removed and (only) the @trigger_error are added in files. Also updated the module description with info about the module is being deprecated.

Should the deprecation message also include a link to the contrib module for Drupal 9?

rpsu’s picture

StatusFileSize
new4.56 KB
new8.64 KB

Uploading correct patch & interdiff.

rpsu’s picture

StatusFileSize
new5.68 KB
new2.77 KB

I decided to add the deprecation msg to class docblocks, too.

The last submitted patch, 17: deprecate_place_block-3062281-17.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Status: Needs review » Needs work

The last submitted patch, 18: deprecate_place_block-3062281-18.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

rpsu’s picture

Apparently creating branch for D9 is not the way here, but rather (re) create the block_place module only with branch 8.x-1.x (which will take precedence if present over the core's block_place).

Copying here what @mixologic wrote about branching and moving the module to contrib space:

Composer doesnt allow for multiple things to share the same namespace, so, in effect a contrib module and a core module should not share the same name, because composer's dependency mapping will break. normally what would happen is the contrib module would be forced to use the drupal/projectname-modulename pattern for the namespace, because core already owns the drupal/projectname namespace.

The problem will be if there are other contrib modules that have a dependency on block_place.

I looked at it for the simpletest module, and, since no contrib has a constraint on a specific version of simpletest, then we can move it to contrib, and make sure that it gets the drupal/simpletest namespace, because then modules will end up with a dep on the contrib module instead of the core module, and everything should be happy.

Same goes for block_place. If there are contrib that rely on a specific version then we might have to figure something out. - good news is that I just did a query and it doesnt appear as though there are any contrib modules relying on the block_place module, which means I can add it to the exception list for when we remove it, so that if people need to add it with composer they can.

tl;dr; - block_place should be fine as is. Do not create a 9.x branch, please create an 8.x- branch for now.

rpsu’s picture

1. Create a https://www.drupal.org/project/block_place contrib project from the 8.8.x codebase of the module. The project page should indicate that it has no further development and will not have any releases for Drupal 8 or 10, and recommend Layout Builder instead.

This is now done apart from the module not having yet releases. Once I've run the tests with d.o. test infrastructure it'll land, too.

rpsu’s picture

StatusFileSize
new7.94 KB

Deprecations trigger_error()'s added to
- after namespace in class files
- class dockblock
- class constructor
- beginning of .module file
- services file
- info.yml file

All of them are pointing to the change record node.

rpsu’s picture

Status: Needs work » Needs review

I'm not sure how to deal with this - tests are failing because of all the deprecation notices added by the patch.

Patch itself seems to be doing what it is supposed to do, and has no errors. however if this patch gets committed, does it not mean that core tests start failing, too?

https://www.drupal.org/core/deprecation#what-not says:

What we can not deprecate
Do not deprecate test classes. Any test that could be considered deprecated should be removed or modified to be relevant.

Tests which exercise deprecated code can be annotated with @group legacy in order to avoid deprecation notices during testing, but a follow-up issue should be filed in order to fix such tests to not exercise deprecated code.

So I think Place Block tests should not be deprecated. But I hesitate to add @group legacy to the currently failing tests since I believe it would hide other test failures, too?

berdir’s picture

> But I hesitate to add @group legacy to the currently failing tests since I believe it would hide other test failures, too?

That's a risk we have to take and it's OK because it doesn't matter if the core module uses deprecated code.

So yes, you have to add that. It's the same with our upgrade test, they all also have @group legacy.

rpsu’s picture

I see, thanks @Berdir for the input.

rpsu’s picture

StatusFileSize
new13.14 KB
new7.05 KB

Status: Needs review » Needs work

The last submitted patch, 27: deprecate_place_block-3062281-27.patch, failed testing. View results

rpsu’s picture

Status: Needs work » Needs review
StatusFileSize
new13.59 KB
new470 bytes

Forgot that naturally also Place Block test need to have @group legacy, too.

rpsu’s picture

These aren't done yet:

3.
Add a status report info message that the module is deprecated and will be moved to contrib in Drupal 9. Recommend Layout builder.

4. Add an install warning message as above.

rpsu’s picture

Assigned: Unassigned » rpsu
Status: Needs review » Needs work
rpsu’s picture

Status: Needs work » Needs review
StatusFileSize
new16.12 KB
new10.59 KB

Added status-report -page info, installation time warning (visible only when installing with drush/drupal console, as the module is hidden in /admin/modules -page) and made the messages/errors/info be more consistently formatted.

shelane’s picture

This may not be the right place to ask this, but I feel I must. I don't understand how Layout Builder supersedes the functionality. When a block (let's say a menu block) has to be placed across nearly all pages (let's say all but landing page content type) and this includes pages created by views panels (yes, it still exists), or modules, how does layout builder solve that issue? Placing blocks in a region across all of these type of pages has been in use for a long time. I thought Block Place got it right where it allowed you to place the same block in multiple places with the potential for different configuration.

rpsu’s picture

Umm. Libraries need still deprecation info, see comment comment #7

rpsu’s picture

Status: Needs review » Needs work

Umm. Libraries need still deprecation info, see comment comment #7

https://www.drupal.org/node/3064022

rpsu’s picture

Assigned: rpsu » Unassigned
Status: Needs work » Needs review
StatusFileSize
new17.12 KB
new1.93 KB

Including the deprecation of *.libraries.yml.

xjm’s picture

From @Berdir in Slack, related to #33:

that's the part that I don't quite get, because LB is about controlling the layout of an entity? while block_place is about placing blocks in theme regions. LB would need to completely replace block.module aka provide its own DisplayVariant to take over the whole page and I thought you still need panels/page manager for that use case?

xjm’s picture

Following up on #33 and #37, this project is the recommended contrib replacement if the blocks specifically need to be placed in a theme region:
https://www.drupal.org/project/lb_everywhere

That functionality won't be in core before (probably) 9.1, but it is the future-compatible solution.

I think we should add this information to the change record and release note, but don't need to mention it in the deprecation messages since it's not techncially in core yet.

catch’s picture

Status: Needs review » Reviewed & tested by the community

lb_everywhere is in a bullet point in the change record now (I just went to add it and found it). Seems sensible to put it there but not in the core message - let people read the change record.

Patch looks ready to me.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 36: deprecate_place_block-3062281-36.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

catch’s picture

That's a real test failure due to the help topics commit and the deprecation notices introduced here.

rpsu’s picture

Status: Needs work » Needs review
StatusFileSize
new759 bytes
new616 bytes

Marked HelpTopicsSyntaxTest::testHelpTopics as legacy, and added it also to the "fix later" issue #3084471: Remove/fix legacy tests after Place Blocks -module removal

catch’s picture

Status: Needs review » Reviewed & tested by the community

Assuming this is green, back to RTBC.

The 9.x follow-up to un-@legacy those tests is a good approach IMO.

larowlan’s picture

Status: Reviewed & tested by the community » Needs work

Patch went from 17kb to 759 bytes, mix up?

Reviewing the previous patch.

+++ b/core/modules/help_topics/tests/src/Functional/HelpTopicsSyntaxTest.php
@@ -29,6 +29,8 @@ class HelpTopicsSyntaxTest extends BrowserTestBase {
+   * @group legacy

I don't think this is the correct approach, I'd prefer to exclude block_place from the test, see \Drupal\Tests\help_topics\Functional\HelpTopicsSyntaxTest::testHelpTopics it enables all core modules it finds, I think we should just remove block_place from that list

The previous patch looks good though, so just this change and fix to the actual patch

Thanks!

rpsu’s picture

Very much a mixup, sorry.

If the Help Topics test is not marked as legacy, it is handled differently than all other tests (see #3084471: Remove/fix legacy tests after Place Blocks -module removal) - is that intentional?

The plan is to fix the those tests marked by this deprecation as legacy once module is removed (in branch 9.0.x).

I'll fix the patch once the intended approach is confirmed.

rpsu’s picture

StatusFileSize
new18.08 KB
new981 bytes

New patch, not marking HelpTopics test as legacy but simply not enabling the Place Block module for the tests.

rpsu’s picture

Status: Needs work » Needs review
catch’s picture

+++ b/core/modules/help_topics/tests/src/Functional/HelpTopicsSyntaxTest.php
@@ -36,6 +36,11 @@ public function testHelpTopics() {
+    // @todo Temporary exclusion of a deprecated Place block -module.

nit: s/Place block -module/Place block module/

Otherwise I'd mark this RTBC.

We need an explicit follow-up to un-legacy the tests that are legacied here.

acbramley’s picture

StatusFileSize
new18 KB
new741 bytes

FIxes #48

jibran’s picture

Status: Needs review » Reviewed & tested by the community

#48 is addressed so back to RTBC.

larowlan’s picture

Status: Reviewed & tested by the community » Needs review
larowlan’s picture

Status: Needs review » Fixed

Committed f2955eb and pushed to 9.0.x. Thanks!

c/p to 8.8.x and 8.9.x

  • larowlan committed f2955eb on 9.0.x
    Issue #3062281 by rpsu, acbramley, xjm, catch, Berdir: Deprecate and...

  • larowlan committed 2c2ac0d on 8.9.x
    Issue #3062281 by rpsu, acbramley, xjm, catch, Berdir: Deprecate and...

  • larowlan committed 93b7946 on 8.8.x
    Issue #3062281 by rpsu, acbramley, xjm, catch, Berdir: Deprecate and...
mikelutz’s picture

I wish I had seen this before it got committed, I would have objected to all of these migration tests being marked @legacy. They are the main tests of several code paths in the migration system and now they will not alert us if any code in those paths becomes deprecated. I realize we are essentially done adding deprecations in D8, but I really hope this doesn't come back to bite us later.

  • larowlan committed af98f5b on 9.0.x
    Revert "Issue #3062281 by rpsu, acbramley, xjm, catch, Berdir: Deprecate...

  • larowlan committed 8c404c8 on 8.9.x
    Revert "Issue #3062281 by rpsu, acbramley, xjm, catch, Berdir: Deprecate...
larowlan’s picture

Status: Fixed » Needs work

Discussed this with @mikelutz and @xjm in slack.

We are in agreement that the loss of coverage for Migrate module is not ideal and have decided to roll this back, and work on a more appropriate fix, which is to exclude block place from those tests, like we did for the help topics one.

Reverting from all three branches

  • larowlan committed 61590bf on 8.8.x
    Revert "Issue #3062281 by rpsu, acbramley, xjm, catch, Berdir: Deprecate...
larowlan’s picture

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

catch’s picture

Version: 8.9.x-dev » 8.8.x-dev
Status: Needs work » Needs review
StatusFileSize
new16.36 KB
new9.14 KB

Here's a start on that, untested.

rpsu’s picture

StatusFileSize
new33.3 KB
new23.84 KB

oh, working in parallel..

this is an alternative approach - $deprecated_modules is a class variable and used as such to exclude some (one) modules.

Also I duplicated tests to 2, where one is marked as legacy and does NOT skip block_place, and the original one skips it.

I feel this might be an overkill solution, but on the other hand it is extendable.

mikelutz’s picture

  1. +++ b/core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistLegacyTest.php
    @@ -0,0 +1,20 @@
    +class MigrationProvidersExistLegacyTest extends MigrationProvidersExistTest {
    

    the legacy versions should start with Legacy (i.e. LegacyMigrationProvidersExistTest, not MigrationProvidersExistLegacyTest)

  2. +++ b/core/modules/migrate_drupal_ui/tests/src/Kernel/MigrationLabelExistTest.php
    @@ -37,4 +40,19 @@ public function testLabelExist() {
    +  /**
    +   * Enables all modules, except the ones marked as deprecated.
    +   */
    +  public function enableAllModules() {
    +    // Install all available modules.
    +    $module_handler = $this->container->get('module_handler');
    +    $modules = $this->coreModuleListDataProvider();
    +    $modules_enabled = $module_handler->getModuleList();
    +    $modules_to_enable = array_keys(array_diff_key($modules, $modules_enabled));
    +    $modules_to_enable = array_diff($modules_to_enable,
    +                                    $this->deprecated_modules);
    +    $this->enableModules($modules_to_enable);
    +
    +  }
    +
    

    Some of the reused logic should go into a trait, if we have to explictly name block_place as the only deprecated module, that should be defined once somewhere in that trait.

catch’s picture

fwiw https://www.drupal.org/project/drupal/issues/3062281#comment-13305130 is just changing the migration trait that provides the list of all modules to remove block_place

Status: Needs review » Needs work

The last submitted patch, 64: deprecate_place_block-3062281-64.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

rpsu’s picture

Status: Needs work » Needs review
StatusFileSize
new39.14 KB
new33.51 KB

I wrote a new trait (did not dare to touch the one @catch had altered in his patch). I'm happy to go either way but the FileSystemModuleDiscoveryDataProviderTrait is not used in all the tests. Core modules seem to have their own ways to get list of core modules in many cases.

Also test classes using the block_place module are now renamed.

Status: Needs review » Needs work

The last submitted patch, 68: deprecate_place_block-3062281-68.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

rpsu’s picture

Umm.probaly a brainfart in the trait, block_place module seems to be enabled after all.

rpsu’s picture

StatusFileSize
new39.08 KB
new1.28 KB

New patch, hopefully less brainfarts.

rpsu’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 71: deprecate_place_block-3062281-71.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

rpsu’s picture

Status: Needs work » Needs review
StatusFileSize
new40.1 KB
new11.37 KB

maybe now

Status: Needs review » Needs work

The last submitted patch, 74: deprecate_place_block-3062281-74.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

rpsu’s picture

Status: Needs work » Needs review
StatusFileSize
new40.57 KB
new23.61 KB

Coding standard fixes, mainly (not meeting *all* of what phpcs wines about, though.

Locally tests are passing fine in all the changed/added tests, but Drupal CI still displays errors?

Status: Needs review » Needs work

The last submitted patch, 76: deprecate_place_block-3062281-76.patch, failed testing. View results

rpsu’s picture

Status: Needs work » Needs review
StatusFileSize
new40.44 KB
new1.75 KB

Remove test code that sneaked into the previous patch. Fix module array cleaning when module machine name is the key.

rpsu’s picture

StatusFileSize
new37.7 KB
new11.52 KB

Looks like help_topics module has disappeared here in between.

Status: Needs review » Needs work

The last submitted patch, 79: deprecate_place_block-3062281-80.patch, failed testing. View results

rpsu’s picture

Xjm @Slack

Do what I said, but un-deprecating event subscribers seems fine if that makes tests pass

this will likely help the need to create a set of Legacy-tests, and the need for the trait.

rpsu’s picture

StatusFileSize
new31.23 KB

Trying out the patch here: due to upstream changes I can't rebase / apply previous patches anymore.

"undeprecated" the BlockPlaceEventSubscriber to avoid other core modues testing in a very greedy way to trigger deprecation errors where.

I expect this to need more work but I just wanna see the failing tests now.

rpsu’s picture

StatusFileSize
new38.56 KB
new36.23 KB

checking how CI likes this now, and if ti does not will start removing @trigger_error's starting i Drupal\block_place\Plugin\DisplayVariant\PlaceBlockPageVariant

rpsu’s picture

StatusFileSize
new38.5 KB
new2.92 KB

remove debuggers, correct one boolean and keeping thumbs up (but most likely need to actually comment out the @trigger_warning() from Drupal\block_place\Plugin\DisplayVariant\PlaceBlockPageVariant

rpsu’s picture

StatusFileSize
new38.78 KB
new1.49 KB
rpsu’s picture

Status: Needs work » Needs review
StatusFileSize
new39.07 KB
new1.49 KB

Commented out the @trigger_error() also from the Drupal\block_place\Plugin\DisplayVariant\PlaceBlockPageVariant::_constructor(), now this will be finally passing.

// This is disabled to avoid deprecation warnings in
// Drupal\Tests\migrate_drupal\Kernel\d7\ValidateMigrationStateTest and
// Drupal\Tests\migrate_drupal\Kernel\d6\ValidateMigrationStateTest
// due to issues finding where exactly the test enables all (?) core modules.

I'll update the follow up #3084471: Remove/fix legacy tests after Place Blocks -module removal with the classes that have been added or altered once the tests have passed.

rpsu’s picture

StatusFileSize
new39.23 KB
new4.01 KB

Cleaning up notation (coding standards) and removing the last final @deprecated and assuming it is the last possible warning triggerer.

tim.plunkett’s picture

+++ b/core/modules/block_place/block_place.module
@@ -3,8 +3,20 @@
+@trigger_error('The ' . __NAMESPACE__ . '\PlaceBlockPageVariant is
+  deprecated in drupal:8.8.0 and will be removed from drupal:9.0.0. Using Layout
+  Builder (available in Drupal 8.7.0) module is recommended, or alternatively ¶
+  you may use the contrib module Place Blocks. See ¶
+  https://www.drupal.org/node/3081957.', E_USER_DEPRECATED);

This mentions PlaceBlockPageVariant in the .module file, not sure why? I think this is the cause of the remaining fails.

Status: Needs review » Needs work

The last submitted patch, 87: deprecate_place_block-3062281-87.patch, failed testing. View results

rpsu’s picture

Status: Needs work » Needs review
StatusFileSize
new39.49 KB
new2.7 KB

Removing the @trigger_error from the .module -file (with some coding style - spacing - fixes).

rpsu’s picture

Status: Needs review » Needs work

It this passes (the .module trigger message error was erroneous) I'll try to see if the PlaceBlockPageVariant can actually have the deprecations declared.

rpsu’s picture

StatusFileSize
new38.67 KB
new3.87 KB

I'll try to see if the PlaceBlockPageVariant can actually have the deprecations declared.

tim.plunkett’s picture

Status: Needs work » Needs review
xjm’s picture

Title: Deprecate and remove block_place module in Drupal 9 » Deprecate block_place module for removal in Drupal 9
Issue tags: +Needs release manager review, +Needs release note

Great work on this! Yay, green patch.

I should probably should put the RM tag on just to make sure we double-check the disruptions once we get to the final versions. We might also want to mention this in the release notes given that it's a whole module, so tagging for that.

catch’s picture

  1. +++ b/core/modules/block_place/block_place.install
    @@ -0,0 +1,36 @@
    + */
    +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. Using Layout Builder (available in Drupal 8.7.0) module is recommended, or alternatively you may use the contrib module <a href=":contrib-link">Place Block</a>. See <a href=":change-record">the change record</a>.', [
    +        ':change-record' => 'https://www.drupal.org/node/3081957',
    +        ':contrib-link' => 'https://www.drupal.org/project/block_place',
    +      ]),
    +    ];
    +  }
    +
    +  return $requirements;
    

    +1

  2. +++ b/core/modules/block_place/block_place.install
    @@ -0,0 +1,36 @@
    +
    +/**
    + * 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. Using Layout Builder (available in Drupal 8.7.0) module is recommended, or alternatively you may use the contrib module <a href=":contrib-link">Place Block</a>. See <a href=":change-record">the change record</a>.', [
    +    ':change-record' => 'https://www.drupal.org/node/3081957',
    +    ':contrib-link' => 'https://www.drupal.org/project/block_place',
    +  ]));
    +}
    

    Also +1

  3. +++ b/core/modules/block_place/block_place.install
    @@ -0,0 +1,36 @@
    diff --git a/core/modules/block_place/block_place.libraries.yml b/core/modules/block_place/block_place.libraries.yml
    
    diff --git a/core/modules/block_place/block_place.libraries.yml b/core/modules/block_place/block_place.libraries.yml
    index 0671252032..a257695ab5 100644
    
    index 0671252032..a257695ab5 100644
    --- a/core/modules/block_place/block_place.libraries.yml
    
    --- a/core/modules/block_place/block_place.libraries.yml
    +++ b/core/modules/block_place/block_place.libraries.yml
    
    +++ b/core/modules/block_place/block_place.libraries.yml
    +++ b/core/modules/block_place/block_place.libraries.yml
    @@ -3,9 +3,11 @@ drupal.block_place:
    
    @@ -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. Using Layout Builder (available in drupal:8.7.0) module is recommended, or alternatively you may use the contrib module Place Blocks. 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. Using Layout Builder (available in drupal:8.7.0) module is recommended, or alternatively you may use the contrib module Place Blocks. See https://www.drupal.org/node/3081957.
    diff --git a/core/modules/block_place/block_place.module b/core/modules/block_place/block_place.module
    

    I'm not sure if we really need to individually mark all these things deprecated, but also it doesn't do any harm and may help in the case some code relies on these.

  4. +++ b/core/modules/block_place/block_place.module
    @@ -3,8 +3,26 @@
     
    +/*
    + * This is disabled to avoid deprecation warnings in
    + * Drupal\Tests\migrate_drupal\Kernel\d7\ValidateMigrationStateTest and
    + * Drupal\Tests\migrate_drupal\Kernel\d6\ValidateMigrationStateTest
    + * due to issues finding where exactly the test enables all (?) core
    + * modules.
    + */
    +// @trigger_error('The Block Place -module is deprecated in drupal:8.8.0
    +// and will be removed from drupal:9.0.0. Using Layout Builder (available in
    +// Drupal 8.7.0) module is recommended, or alternatively you may use the contrib
    +// module Place Blocks. See https://www.drupal.org/node/3081957.',
    +// E_USER_DEPRECATED);.
    

    I think we can remove this whole section rather than commenting it out.

  5. +++ b/core/modules/block_place/src/Plugin/DisplayVariant/PlaceBlockPageVariant.php
    @@ -2,6 +2,12 @@
     
    +@trigger_error('The ' . __NAMESPACE__ . '\PlaceBlockPageVariant is
    + deprecated in drupal:8.8.0 and will be removed from drupal:9.0.0. Using
    + Layout Builder (available in Drupal 8.7.0) module is recommended, or
    + alternatively you may use the contrib module Place Blocks. See
    + https://www.drupal.org/node/3081957.', E_USER_DEPRECATED);
    +
    

    Given we're deprecating in the constructor, I don't think we also need this one.

rpsu’s picture

StatusFileSize
new37.55 KB
new2.21 KB

New patch fixing the mentioned issues in #95 + one coding standards addition (adding relevant @see URL after @deprecated in docblock)

tedbow’s picture

Status: Needs review » Needs work

Looking good!

Just a couple nits and an idea that might simplify things and remove duplicate documentation.

  1. +++ b/core/modules/block_place/block_place.module
    @@ -47,7 +57,6 @@ function block_place_toolbar() {
    -
    
    @@ -78,7 +87,7 @@ function block_place_toolbar() {
    -   ],
    +    ],
    

    These changes seem unrelated

  2. +++ b/core/modules/block_place/src/EventSubscriber/BlockPlaceEventSubscriber.php
    @@ -36,6 +36,7 @@ class BlockPlaceEventSubscriber implements EventSubscriberInterface {
    +
    

    Unrelated change

  3. +++ b/core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php
    @@ -14,6 +15,15 @@
    +  /**
    +   * Flag to exclude deprecated modules from the tests.
    +   *
    +   * @var bool
    +   */
    +  protected $excludeDeprecated = TRUE;
    
    @@ -119,6 +129,8 @@ protected function enableAllCoreModules() {
    +    $module_list = $this->removeDeprecatedModules($module_list,
    +      $this->excludeDeprecated);
    

    I am not sure why this is class property and then it is only used 1 place?

    But then where it is used it is the default value to removeDeprecatedModules() anyways

  4. +++ b/core/modules/field/tests/src/Kernel/LegacyFieldTypePluginManagerTest.php
    @@ -0,0 +1,20 @@
    +   * Flag to exclude deprecated modules from the tests.
    +   *
    +   * @var bool
    +   */
    +  protected $excludeDeprecated = FALSE;
    

    Oh I see now why \Drupal\Tests\field\Kernel\FieldTypePluginManagerTest::$excludeDeprecated is set now to the default.

    So we have this pattern in all the tests that use DeprecatedModulesTestTrait to have the test that will be extended with the Legacy*Test to declare

    protected $excludeDeprecated = TRUE;
    and then the actual Legacy*Test to declare

    protected $excludeDeprecated = FALSE;

    and then in all the tests you have to have the exact same docblock in both test classes

    /**
     * Flag to exclude deprecated modules from the tests.
     *
     * @var bool
     */
    

    It seems like it would easier to have
    protected $excludeDeprecated = TRUE;
    directly on
    DeprecatedModulesTestTrait
    Then half the classes won't need to declare this at all
    and the other half the Legacy*Test classes could have

    /**
     * {@inheritdoc}
     */
     protected $excludeDeprecated = FALSE;
    
    

    Therefor you won't have to have the duplicate docblock on all these classes.

    You could also then remove the $remove parameter from \Drupal\Tests\DeprecatedModulesTestTrait::removeDeprecatedModules()
    and just access it via $this->excludeDeprecated like $this->deprecatedModules is accessed.

    That way the parmeter doesn't have to be documented either which is basically a duplication of the $this->excludeDeprecated field documentation.

rpsu’s picture

Status: Needs work » Needs review
StatusFileSize
new35.15 KB
new17.63 KB

Good feedback, thanks! This patch addresses the issued in #97. I also removed the unrelated changes, even if the block_place.module -file change is coding standards issue (and was autofixed by my linter).

rpsu’s picture

Issue summary: View changes
tedbow’s picture

Status: Needs review » Needs work
Issue tags: -Needs release note +Needs release note

@rpsu thanks for the updates

  1. +++ b/core/modules/help_topics/tests/src/Functional/HelpTopicsSyntaxTest.php
    @@ -19,6 +20,13 @@
    +  /**
    +   * {@inheritdoc}
    +   */
    +  protected $excludeDeprecated = TRUE;
    

    For all the tests in this patch that do not start with Legacy* we don't actually need this field in the class at all. Since it is on the trait with the same value.

  2. +++ b/core/modules/help_topics/tests/src/Functional/HelpTopicsSyntaxTest.php
    @@ -36,6 +44,9 @@ public function testHelpTopics() {
    +    // Exclude deprecated modules from the modules list.
    +    $module_directories = $this->removeDeprecatedModules($module_directories,
    +      $this->excludeDeprecated);
    

    We don't need the 2nd argument now.

    I personally don't think we need the comment either because the method name explains and the docblock with give all the details.

    But I don't feel strongly about this.

    I think most or all of the calls to removeDeprecatedModules() still have 2nd argument.

  3. +++ b/core/modules/migrate_drupal/tests/src/Kernel/LegacyStateFileExists.php
    @@ -0,0 +1,23 @@
    +/**
    + * Tests that core modules have a migrate_drupal.yml file as needed.
    + *
    + * Checks that each module that requires a migrate_drupal.yml has the file.
    + * Because more that one migrate_drupal.yml file may have the same entry the
    + * ValidateMigrationStateTest, which validates the file contents, is not able
    + * to determine that all the required files exits.
    

    I generally think we should not be duplicating the documentation of the class the Legacy* test classes are extending.

    One suggestion would be this pattern

    /**
     * Extends HelpTopicsSyntaxTest to test with deprecated modules.
     *
     * @see \Drupal\Tests\DeprecatedModulesTestTrait::removeDeprecatedModules()
    

    I not sure if we can get away with not doing the full namespace in the first line comment. But I couldn't keep it under the limit if I added the full name space.

  4. +++ b/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/DestinationCategoryTest.php
    @@ -26,7 +27,7 @@ class DestinationCategoryTest extends MigrateDrupalTestBase {
    -
    +  use DeprecatedModulesTestTrait;
    

    although this doesn't fail our coding standards this remove the empty line between the trait use statements the rest of the class. I think it is more readable and we usually have this empty line.

  5. +++ b/core/modules/migrate_drupal_ui/tests/src/Kernel/MigrationLabelExistTest.php
    @@ -14,21 +15,23 @@
    -    // Install all available modules.
    -    $module_handler = $this->container->get('module_handler');
    -    $modules = $this->coreModuleListDataProvider();
    -    $modules_enabled = $module_handler->getModuleList();
    -    $modules_to_enable = array_keys(array_diff_key($modules, $modules_enabled));
    -    $this->enableModules($modules_to_enable);
    +
    +    $this->enableAllModules();
    
    @@ -37,4 +40,19 @@ public function testLabelExist() {
    +  /**
    +   * Enables all modules, except the ones marked as deprecated.
    +   */
    +  public function enableAllModules() {
    +    // Install all available modules.
    +    $module_handler = $this->container->get('module_handler');
    +    $modules = $this->coreModuleListDataProvider();
    +    $modules_enabled = $module_handler->getModuleList();
    +    $modules_to_enable = array_keys(array_diff_key($modules, $modules_enabled));
    +    $modules_to_enable = $this->removeDeprecatedModules($modules_to_enable,
    +      $this->excludeDeprecated);
    +    $this->enableModules($modules_to_enable);
    +
    +  }
    

    Now that we have trait the only change between the code that is moved into the function is the call to removeDeprecatedModules().

    So it seem it would be better to just add that 1 line. Especially because the function name is enableAllModules() but then in the docblock we have explain that actually no it is not all modules 😜.

  6. +++ b/core/modules/migrate_drupal_ui/tests/src/Kernel/MigrationLabelExistTest.php
    @@ -14,21 +15,23 @@
    -    // Get all the migrations
    +    // Get all the migrations.
    

    Unrelated change.

  7. +++ b/core/tests/Drupal/Tests/DeprecatedModulesTestTrait.php
    @@ -0,0 +1,49 @@
    +
    

    Generally we don't have empty lines to start off functions. There might be a couple of cases of this in the patch.

  8. +++ b/core/tests/Drupal/Tests/DeprecatedModulesTestTrait.php
    @@ -0,0 +1,49 @@
    +    if ((bool) $this->excludeDeprecated) {
    

    I don't think we need the cast to bool here. Doesn't php do this automatically for if statements?

    Check some other similar cases like \Drupal\Tests\BrowserHtmlDebugTrait::$htmlOutputEnabled and we don't do this cast.

  9. +++ b/core/tests/Drupal/Tests/DeprecatedModulesTestTrait.php
    @@ -0,0 +1,49 @@
    +      // Remove matching item searching matching values.
    +      $modules = array_diff($modules, $this->deprecatedModules);
    +      // Remove matching item searching matching keys.
    +      $modules = array_diff_key($modules, array_flip($this->deprecatedModules));
    

    I am little confused by these comments.

    They seem to just be explaining what the php array functions. I don't think we need that.

    Without reading more of the issue I don't know why we are searching for the module names as both values and keys of the array. I think if this code needs comment that would be better.

    In which cases would be 1 or the other?

  10. +++ b/core/modules/block_place/block_place.module
    @@ -3,6 +3,12 @@
    + * @deprecated in drupal:8.8.0 and will be removed from drupal:9.0.0. Using
    + * Layout Builder (available in Drupal 8.7.0) module is recommended, or
    + * alternatively you may use the contrib module Place Blocks.
    

    1 last thing related to #33, #37 and #38

    It seems weird to me that here and elsewhere we are recommending Layout Builder as a replacement.

    "Place Blocks" can place blocks in your theme regions. Layout Builder can't do that(currently). But if I was using "Place Blocks" and someone told be I could use Layout Builder instead if I didn't know what layout builder did I would assume it could at least do what the module I was previously using could do.

    Of course you can leave certain theme regions empty or remove them to get the same effect using Layout Builder but it is more complicated and takes work and planning.

    It seems like the real replacement is either use the contrib project or just turn it off and use the Block UI module.

    Luckily this module only provides a different UX so that if you turn it off all your blocks will still work.

    I think offering Layout Builder as replacement here could do more harm than good. One of the big UX problems we had to solve in Layout Builder is getting the user to understand which parts of the page are controlled by layout builder and which are not.
    see #2935779: Come up with an affordance for what parts of the page are/are not affected by Layout Builder and #2938182: Design intuitive affordances for Layout Builder (for illustrating which parts of the page are editable in a given context)
    Suggesting it as replacement for "Place Blocks" just muddies the waters.

    What if a user on this advice decides to use layout builder and they don't understand which parts of the page Layout builder controls. It could also be more confusing because when you are viewing */layout the themes regions might not be shown because they may be empty. So if the layout is set up with a header and multi-column sections it might look like your theme regions.

    It could be extra confusing because some of the users of "Place Blocks" might already using Layout Builder. This advice might give them the impression that they are is extra feature of Layout Builder they haven't discovered, placing blocks in regions.

xjm’s picture

@tedbow Regarding #100.10, maybe we should just say "See the change record for a list of alternatives"? We mention lb_everywhere there as well as the contrib replacement module: https://www.drupal.org/node/3081957

tedbow’s picture

  1. re #101 @xjm yeah that sounds good.
  2. re #100.9
    +++ b/core/modules/help_topics/tests/src/Functional/HelpTopicsSyntaxTest.php
    @@ -36,6 +44,9 @@ public function testHelpTopics() {
    +    // Exclude deprecated modules from the modules list.
    +    $module_directories = $this->removeDeprecatedModules($module_directories,
    +      $this->excludeDeprecated);
         \Drupal::service('module_installer')->install(array_keys($module_directories));
    

    I think the only case where the $modules array has the module names in the keys of the array instead of the values when calling \Drupal\Tests\DeprecatedModulesTestTrait::removeDeprecatedModules()

    I think we should fix this before the method is called with something like

    $modules_to_install = array_keys($module_directories);
    

    Then can just use this var when installing the modules via \Drupal::service('module_installer')->install() a few lines later.

    That way \Drupal\Tests\DeprecatedModulesTestTrait::removeDeprecatedModules() can be a 1 liner.

    return $this->excludeDeprecated ? array_diff($modules, $this->deprecatedModules) : $modules;
    
rpsu’s picture

Status: Needs work » Needs review
StatusFileSize
new31.97 KB
new34.66 KB
  • #100.1 - addressed, field removed.
  • #100.2 - addressed, and the (leftover) comment removed. The removeDeprecatedModules signature does have 2nd argument anymore, these should've been removed with #98
  • #100.3 - addressed. the few classes where the class name could be mistaken (for an example Drupal\Tests\migrate_drupal\Kernel\d7\LegacyMigrationProcessTest and Drupal\Tests\migrate_drupal\Kernel\d6\LegacyMigrationProcessTest) full class name with namespace is used even if it makes the docblock short description too long to fit in one line.
  • #100.4 - unintentional change, but took an opportunity and sort all the use's in the alphabetical order in all the tests included in the patch
  • #100.5 - addressed - and now also MigrationLabelExistTest is in align with how all other tests do that.
  • #100.6 - reverted. However, since coding standards dictate there should be a full sentence and a dot, how should this kinf of issues be addressed (if at all)?
  • #100.7 - I'm not sure what is this? There is no empty line in the beginning of the file core/tests/Drupal/Tests/DeprecatedModulesTestTrait.php?
  • #100.8 - addressed, casting removed
  • #100.9,#102 - good point, I failed to spot the small change needed in Drupal\Tests\help_topics\Functional\HelpTopicsSyntaxTest::testHelpTopics
  • #100.10 - the text updated all round, removed the suggested alternatives and updated warnings and other texts to point to the CR
rpsu’s picture

and thank you @tedbow and @xjm for the good feedback!

xjm’s picture

  1. +++ b/core/modules/block_place/block_place.info.yml
    @@ -1,6 +1,6 @@
    -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. Using Layout Builder (available in Drupal 8.7.0) module is recommended, or alternatively you may use the contrib module Place Blocks. See https://www.drupal.org/node/3081957.'
    +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.'
    

    One small point for the deprecation message changes. The message should be formatted like:

    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.
    

    (So that it's a separate sentence.)

  2. +++ b/core/modules/block_place/block_place.module
    @@ -21,9 +20,8 @@ function block_place_help($route_name, RouteMatchInterface $route_match) {
    -      $output .= '<p><strong>' . t('Place Blocks (Core, Experimental) is deprecated in Drupal 8.8.0 and will be removed in Drupal 9.0.0. Using Layout Builder (available in Drupal 8.7.0) module is recommended, or alternatively you may use the contrib module <a href=":contrib-link">Place Blocks</a>. See <a href=":change-record">the change record</a>.', [
    +      $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>.', [
    

    For this sentence, since it's in the user interface, we don't need to repeat it. I think it can just say:

    'Place Blocks (Core, Experimental) is deprecated in Drupal 8.8.0 and will be removed in Drupal 9.0.0. <a href=":change-record">See the change record for a list of alternatives</a>.'
    

    (That's also more accessible so that the link text makes sense out of context.)

xjm’s picture

I'll actually just incorporate those changes quickly to save time.

xjm’s picture

StatusFileSize
new31.95 KB
new7.51 KB
tim.plunkett’s picture

This looks great!

Two remaining micro nits:

  1. +++ b/core/modules/block_place/block_place.install
    @@ -0,0 +1,34 @@
    +      '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>.', [
    ...
    +  \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>.', [
    

    and will double space

  2. +++ b/core/modules/block_place/src/Plugin/DisplayVariant/PlaceBlockPageVariant.php
    @@ -56,6 +61,12 @@ class PlaceBlockPageVariant extends BlockPageVariant {
    +    @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);
    

    This is indented weirdly with one space (and weird that the string is broken up like this at all? Does that introduce extra spaces?)

rpsu’s picture

StatusFileSize
new31.93 KB
new2.3 KB
  • #108.1 - whitespace removed
  • #108.2 - @trigger_error message's newlines removed as it does introduce extra spaces (due to indenting).
xjm’s picture

+++ b/core/modules/block_place/block_place.install
@@ -0,0 +1,34 @@
+      '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>.', [

Another double-spaced "and will" here too.

tedbow’s picture

re #103
@rpsu thanks for the continue updates!

  1. re #100.6
    Generally I don't think we are supposed to address coding standard on lines that we are not updating.

    This makes it easier to review patches but also makes it less likely to conflict with other patches that might affect those lines(for a non coding standards fix. Also because of the way patches work if you the lines surrounding it changed in a commit that patch would no longer apply.

    Generally existing coding standards are addressed in 1 patch for the whole rule across the code base. See #2719663: Fix 'Drupal.Commenting.InlineComment.InvalidEndChar' coding standard which does fix this issue, and actually needs work.

    This 1 line change is not big deal but often there are more standards problems in the same so it because worse for patches.

  2. #100.7

    Weird.

    There still some cases of this
    \Drupal\block_place\Plugin\DisplayVariant\PlaceBlockPageVariant::__construct()

    Also DeprecatedModulesTestTrait

    protected $excludeDeprecated = TRUE;
    
  3. re #107 @xjm these changes also look good.
  4. Unrelated to recent changes.

    I am not sure why certain tests where selected to use this new trait.

    But I checked removing the use of the trait on \Drupal\Tests\migrate_drupal\Kernel\d7\MigrationProcessTest which of course removes it from \Drupal\Tests\migrate_drupal\Kernel\d7\LegacyMigrationProcessTest

    Both tests pass without the trait.

    Also true for \Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7AuditIdsTest

    I am probably missing something but I thought I would point that out just incase

tedbow’s picture

I didn't see #109 but it look like #111.2 still is not fixed

rpsu’s picture

StatusFileSize
new31.93 KB
new937 bytes
  • #110 - fixed
  • #111.1 - okay, thanks for the info!
  • #111.2 / #100.7 - looking at the patch itself (the file, without Dreditor) this does not show. I suppose the Dreditor trips to something and displays the line numbers off by one?
  • #112.4 - The tests that are using the trait are the ones that were failing, because the tests (blindly) enable apparently every core module. Most of them I was able to track, one of them I could not even spot where all the core modules were enabled.
martin107’s picture

Issue tags: +Deprecation Removal
tim.plunkett’s picture

Status: Needs review » Needs work

In #89 I pointed out that the deprecation in block_place.module was incorrectly referring to the PageVariant.
#90, instead of changing the text, removed the entire trigger_error().

This made some of the test changes obsolete (like FieldTypePluginManagerTest, I haven't tried them all).

The trigger_error should be restored to the .module

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new2.77 KB
new34.06 KB
new34.34 KB

ok just commenting out the 1 line in the trait to see which tests fail.

changing drupalci.yml because we only changed kernel and functional tests

also a patch with .module file trigger_error back to see the difference in fails

tedbow’s picture

StatusFileSize
new2.18 KB
new32.21 KB
  1. re #111

    looking at the patch itself (the file, without Dreditor) this does not show. I suppose the Dreditor trips to something and displays the line numbers off by one?

    I was looking at the code with the patch applied. with #113 I still see the 2 extra lines mentioned

    Yes these extra lines are hard to see with dreditor. Can't wait till gitlab review integration!

    Fixed

  2. Adding back trigger_error in .module file
  3. Will have to see results of 3062281-116-test-for-fails-with-module-trigger.patch but if there any of the updated or new tests that pass with that patch then either we don't need them or will need to figure out what is going on
tedbow’s picture

re #116

+++ b/core/tests/Drupal/Tests/DeprecatedModulesTestTrait.php
@@ -35,7 +35,7 @@ trait DeprecatedModulesTestTrait {
-    return $this->excludeDeprecated ? array_diff($modules, $this->deprecatedModules) : $modules;
+    //return $this->excludeDeprecated ? array_diff($modules, $this->deprecatedModules) : $modules;

whoops i realise now I should have just changed this to

return $modules;

Oh well. Running locally

The last submitted patch, 116: 3062281-116-test-for-fails.patch, failed testing. View results

tedbow’s picture

StatusFileSize
new2.69 KB
new34.27 KB

another try at the idea in #116

The last submitted patch, 117: 3062281-117.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 121: 3062281-117-no-remove.patch, failed testing. View results

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new8.91 KB
new29.83 KB
  1. ok I see why \Drupal\Tests\migrate_drupal\Kernel\d7\ValidateMigrationStateTest failed in #117

    \Drupal\Tests\migrate_drupal\Traits\ValidateMigrationStateTestTrait::testMigrationState calls \Drupal\Tests\migrate_drupal\Traits\ValidateMigrationStateTestTrait::enableAllModules so the deprecate modules aren't filtered out.

    But it seems like we can just add an override of \Drupal\KernelTests\KernelTestBase::enableModules() which called removeDeprecatedModules()to DeprecatedModulesTestTrait. That the only change to any of the kernel tests would be to use the trait. You won't need any other changes.

    The only other test that needs to change that is not a kernel test is \Drupal\Tests\help_topics\Functional\HelpTopicsSyntaxTest in that case we can just the current change in the patch should work. It calls \Drupal::service('module_installer')->install($modules_to_install); to install modules so that would be difficult to override.

  2. Update......

    Ok it seems like there is another problem some of the tests do

    self::$modules = array_keys($this->coreModuleListDataProvider()); 
    

    in setUp

    So then in setUp ultimately \Drupal\KernelTests\KernelTestBase::getModulesToEnable() is going to be called. This is static so we can't override it our trait because we need to access which we can't in a static function ☹️

    So for those classes when have to add back the logic to call

    self::$modules = $this->removeDeprecatedModules(self::$modules);
    

    in setup.

Status: Needs review » Needs work

The last submitted patch, 124: 3062281-124.patch, failed testing. View results

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new639 bytes
new30.11 KB
  1. I just missed a test class for #124.2

    🤞tests should pass now.

  2. The only things I want to point out about the current patch is \Drupal\Tests\DeprecatedModulesTestTrait::enableModules() is on trait that is used by \Drupal\Tests\help_topics\Functional\HelpTopicsSyntaxTest which is not a kernel test. So it won't have a parent::enableModules() if someone tried to call that later. But it would fatal error so I think that is fine. the docblock mentions it for kernel tests.
tim.plunkett’s picture

Status: Needs review » Needs work
+++ b/core/modules/block_place/src/Plugin/DisplayVariant/PlaceBlockPageVariant.php
@@ -56,6 +61,8 @@ class PlaceBlockPageVariant extends BlockPageVariant {
+    @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);

instead of __NAMESPACE and then typing out the class name, use self::class

for 126.2, I think it's fine as is. Traits and parent:: are weird anyway, and this doesn't make that worse.

tedbow’s picture

Status: Needs work » Needs review

I chatted with @tim.plunkett about this more

search core with regex

@trigger_error\(.*__NAMESPACE there are over 100 results

@trigger_error\(.*self:: there is only 1 existing result

So it makes more sense to leave it the way it is.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Yeah I think those 174 instances are wrong, but let's be consistent here.

Thanks @tedbow!

  • catch committed 5c0a9b4 on 9.0.x
    Issue #3062281 by rpsu, tedbow, xjm, catch, acbramley, tim.plunkett,...

  • catch committed 9558e92 on 8.9.x
    Issue #3062281 by rpsu, tedbow, xjm, catch, acbramley, tim.plunkett,...

  • catch committed 37a4a74 on 8.8.x
    Issue #3062281 by rpsu, tedbow, xjm, catch, acbramley, tim.plunkett,...
catch’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs release manager review, -Needs release note +8.8.0 release notes

Patch didn't apply with git to 9.0.x, but only context so I fixed that locally.

Added a release notes snipped and tagging.

Committed/pushed to 9.0.x/8.9.x and 8.8.x, thanks!

xjm’s picture

Great work, thank you!

Published the CR.

rpsu’s picture

@xjm is the correct release 8.8.0-alpha2, or -beta1? CR states 8.8.0-alpha2 (which I wrote there a few weeks ago).

xjm’s picture

Issue summary: View changes

Adding a link to the CR to the end of the release note.

@rpsu, good catch on the release version for the CR. We generally don't issue an alpha2 unless there's a critical hotfix needed. I'll change it to say beta1.

xjm’s picture

Ah, I see you fixed it already. :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.