Closed (fixed)
Project:
Drupal core
Version:
8.8.x-dev
Component:
block_place.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
17 Jun 2019 at 15:06 UTC
Updated:
22 Nov 2019 at 17:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
xjmSo the module is hidden from the UI, but there's no deprecation messages surfaced. I think in 8.8.x we should:
rm -rfthe thing.Comment #3
xjmComment #4
rpsuWould this be enough for deprecating the module, or do the tests also be marked as deprecated?
Comment #5
rpsuThe 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.
Comment #6
xjmThis 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.
Comment #7
xjmA few suggestions and next steps:
@seeafter the@deprecated: https://www.drupal.org/core/deprecation#how@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.@trigger_error()should start causing block_place tests to fail. We mark the tests as legacy tests to get them to pass again.info.yml,hook_help(), and so on with the same messages.Thanks so much for getting this issue rolling.
Comment #8
andypostI can't find policy about deprecation of modules but there's example in core's
entity_referencemoduleNo need for that, the
trigger_errorshould be added to start of fileComment #9
xjmHere 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!
Comment #10
rpsuI 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
Comment #11
rpsuI 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-nidComment #12
rpsuhttps://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
Comment #13
rpsuDraft change record to be reviewed https://www.drupal.org/node/3081957
Comment #14
rpsuComment #15
rpsuComment #16
rpsuThe method deprecations are now removed and (only) the
@trigger_errorare 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?
Comment #17
rpsuUploading correct patch & interdiff.
Comment #18
rpsuI decided to add the deprecation msg to class docblocks, too.
Comment #21
rpsuApparently creating branch for D9 is not the way here, but rather (re) create the
block_placemodule only with branch8.x-1.x(which will take precedence if present over the core'sblock_place).Copying here what @mixologic wrote about branching and moving the module to contrib space:
Comment #22
rpsuThis 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.
Comment #23
rpsuDeprecations
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.
Comment #24
rpsuI'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:
So I think Place Block tests should not be deprecated. But I hesitate to add
@group legacyto the currently failing tests since I believe it would hide other test failures, too?Comment #25
berdir> 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.
Comment #26
rpsuI see, thanks @Berdir for the input.
Comment #27
rpsuComment #29
rpsuForgot that naturally also Place Block test need to have
@group legacy, too.Comment #30
rpsuThese aren't done yet:
Comment #31
rpsuComment #32
rpsuAdded status-report -page info, installation time warning (visible only when installing with
drush/drupalconsole, as the module is hidden in/admin/modules-page) and made the messages/errors/info be more consistently formatted.Comment #33
shelaneThis 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.
Comment #34
rpsuUmm. Libraries need still deprecation info, see comment comment #7
Comment #35
rpsuUmm. Libraries need still deprecation info, see comment comment #7
https://www.drupal.org/node/3064022
Comment #36
rpsuIncluding the deprecation of
*.libraries.yml.Comment #37
xjmFrom @Berdir in Slack, related to #33:
Comment #38
xjmFollowing 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.
Comment #39
catchlb_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.
Comment #41
catchThat's a real test failure due to the help topics commit and the deprecation notices introduced here.
Comment #42
rpsuMarked
HelpTopicsSyntaxTest::testHelpTopicsas legacy, and added it also to the "fix later" issue #3084471: Remove/fix legacy tests after Place Blocks -module removalComment #43
catchAssuming this is green, back to RTBC.
The 9.x follow-up to un-@legacy those tests is a good approach IMO.
Comment #44
larowlanPatch went from 17kb to 759 bytes, mix up?
Reviewing the previous patch.
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!
Comment #45
rpsuVery 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.
Comment #46
rpsuNew patch, not marking HelpTopics test as legacy but simply not enabling the Place Block module for the tests.
Comment #47
rpsuComment #48
catchnit: 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.
Comment #49
acbramley commentedFIxes #48
Comment #50
jibran#48 is addressed so back to RTBC.
Comment #51
larowlanComment #52
larowlanCommitted f2955eb and pushed to 9.0.x. Thanks!
c/p to 8.8.x and 8.9.x
Comment #56
mikelutzI 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.
Comment #59
larowlanDiscussed 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
Comment #61
larowlanComment #63
catchHere's a start on that, untested.
Comment #64
rpsuoh, 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.
Comment #65
mikelutzthe legacy versions should start with Legacy (i.e. LegacyMigrationProvidersExistTest, not MigrationProvidersExistLegacyTest)
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.
Comment #66
catchfwiw 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
Comment #68
rpsuI 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.
Comment #70
rpsuUmm.probaly a brainfart in the trait, block_place module seems to be enabled after all.
Comment #71
rpsuNew patch, hopefully less brainfarts.
Comment #72
rpsuComment #74
rpsumaybe now
Comment #76
rpsuCoding standard fixes, mainly (not meeting *all* of what
phpcswines about, though.Locally tests are passing fine in all the changed/added tests, but Drupal CI still displays errors?
Comment #78
rpsuRemove test code that sneaked into the previous patch. Fix module array cleaning when module machine name is the key.
Comment #79
rpsuLooks like
help_topicsmodule has disappeared here in between.Comment #81
rpsuXjm @Slack
this will likely help the need to create a set of Legacy-tests, and the need for the trait.
Comment #82
rpsuTrying 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.
Comment #83
rpsuchecking how CI likes this now, and if ti does not will start removing
@trigger_error's starting iDrupal\block_place\Plugin\DisplayVariant\PlaceBlockPageVariantComment #84
rpsuremove debuggers, correct one boolean and keeping thumbs up (but most likely need to actually comment out the
@trigger_warning()fromDrupal\block_place\Plugin\DisplayVariant\PlaceBlockPageVariantComment #85
rpsuComment #86
rpsuCommented out the
@trigger_error()also from theDrupal\block_place\Plugin\DisplayVariant\PlaceBlockPageVariant::_constructor(), now this will be finally passing.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.
Comment #87
rpsuCleaning up notation (coding standards) and removing the last final @deprecated and assuming it is the last possible warning triggerer.
Comment #88
tim.plunkettThis mentions PlaceBlockPageVariant in the .module file, not sure why? I think this is the cause of the remaining fails.
Comment #90
rpsuRemoving the @trigger_error from the .module -file (with some coding style - spacing - fixes).
Comment #91
rpsuIt this passes (the .module trigger message error was erroneous) I'll try to see if the PlaceBlockPageVariant can actually have the deprecations declared.
Comment #92
rpsuI'll try to see if the PlaceBlockPageVariant can actually have the deprecations declared.
Comment #93
tim.plunkettComment #94
xjmGreat 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.
Comment #95
catch+1
Also +1
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.
I think we can remove this whole section rather than commenting it out.
Given we're deprecating in the constructor, I don't think we also need this one.
Comment #96
rpsuNew patch fixing the mentioned issues in #95 + one coding standards addition (adding relevant @see URL after @deprecated in docblock)
Comment #97
tedbowLooking good!
Just a couple nits and an idea that might simplify things and remove duplicate documentation.
These changes seem unrelated
Unrelated change
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()anywaysOh I see now why
\Drupal\Tests\field\Kernel\FieldTypePluginManagerTest::$excludeDeprecatedis set now to the default.So we have this pattern in all the tests that use
DeprecatedModulesTestTraitto have the test that will be extended with theLegacy*Testto declareprotected $excludeDeprecated = TRUE;and then the actual
Legacy*Testto declareprotected $excludeDeprecated = FALSE;and then in all the tests you have to have the exact same docblock in both test classes
It seems like it would easier to have
protected $excludeDeprecated = TRUE;directly on
DeprecatedModulesTestTraitThen half the classes won't need to declare this at all
and the other half the
Legacy*Testclasses could haveTherefor you won't have to have the duplicate docblock on all these classes.
You could also then remove the
$removeparameter from\Drupal\Tests\DeprecatedModulesTestTrait::removeDeprecatedModules()and just access it via
$this->excludeDeprecatedlike$this->deprecatedModulesis accessed.That way the parmeter doesn't have to be documented either which is basically a duplication of the
$this->excludeDeprecatedfield documentation.Comment #98
rpsuGood 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).Comment #99
rpsuComment #100
tedbow@rpsu thanks for the updates
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.
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.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
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.
although this doesn't fail our coding standards this remove the empty line between the trait
usestatements the rest of the class. I think it is more readable and we usually have this empty line.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 😜.Unrelated change.
Generally we don't have empty lines to start off functions. There might be a couple of cases of this in the patch.
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::$htmlOutputEnabledand we don't do this cast.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?
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.
Comment #101
xjm@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
Comment #102
tedbowI think the only case where the
$modulesarray 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
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.Comment #103
rpsuremoveDeprecatedModulessignature does have 2nd argument anymore, these should've been removed with #98Drupal\Tests\migrate_drupal\Kernel\d7\LegacyMigrationProcessTestandDrupal\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.use's in the alphabetical order in all the tests included in the patchMigrationLabelExistTestis in align with how all other tests do that.core/tests/Drupal/Tests/DeprecatedModulesTestTrait.php?Drupal\Tests\help_topics\Functional\HelpTopicsSyntaxTest::testHelpTopicsComment #104
rpsuand thank you @tedbow and @xjm for the good feedback!
Comment #105
xjmOne small point for the deprecation message changes. The message should be formatted like:
(So that it's a separate sentence.)
For this sentence, since it's in the user interface, we don't need to repeat it. I think it can just say:
(That's also more accessible so that the link text makes sense out of context.)
Comment #106
xjmI'll actually just incorporate those changes quickly to save time.
Comment #107
xjmComment #108
tim.plunkettThis looks great!
Two remaining micro nits:
and willdouble spaceThis is indented weirdly with one space (and weird that the string is broken up like this at all? Does that introduce extra spaces?)
Comment #109
rpsuComment #110
xjmAnother double-spaced "and will" here too.
Comment #111
tedbowre #103
@rpsu thanks for the continue updates!
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.
Weird.
There still some cases of this
\Drupal\block_place\Plugin\DisplayVariant\PlaceBlockPageVariant::__construct()Also DeprecatedModulesTestTrait
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\MigrationProcessTestwhich of course removes it from\Drupal\Tests\migrate_drupal\Kernel\d7\LegacyMigrationProcessTestBoth tests pass without the trait.
Also true for
\Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7AuditIdsTestI am probably missing something but I thought I would point that out just incase
Comment #112
tedbowI didn't see #109 but it look like #111.2 still is not fixed
Comment #113
rpsuComment #114
martin107 commentedComment #115
tim.plunkettIn #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
Comment #116
tedbowok 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
Comment #117
tedbowI 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
Comment #118
tedbowre #116
whoops i realise now I should have just changed this to
Oh well. Running locally
Comment #121
tedbowanother try at the idea in #116
Comment #124
tedbowok I see why
\Drupal\Tests\migrate_drupal\Kernel\d7\ValidateMigrationStateTestfailed in #117\Drupal\Tests\migrate_drupal\Traits\ValidateMigrationStateTestTrait::testMigrationStatecalls\Drupal\Tests\migrate_drupal\Traits\ValidateMigrationStateTestTrait::enableAllModulesso the deprecate modules aren't filtered out.But it seems like we can just add an override of
\Drupal\KernelTests\KernelTestBase::enableModules()which calledremoveDeprecatedModules()toDeprecatedModulesTestTrait. 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\HelpTopicsSyntaxTestin 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.Ok it seems like there is another problem some of the tests do
in
setUpSo 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
in setup.
Comment #126
tedbow🤞tests should pass now.
\Drupal\Tests\DeprecatedModulesTestTrait::enableModules()is on trait that is used by\Drupal\Tests\help_topics\Functional\HelpTopicsSyntaxTestwhich is not a kernel test. So it won't have aparent::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.Comment #127
tim.plunkettinstead of __NAMESPACE and then typing out the class name, use
self::classfor 126.2, I think it's fine as is. Traits and parent:: are weird anyway, and this doesn't make that worse.
Comment #128
tedbowI chatted with @tim.plunkett about this more
search core with regex
@trigger_error\(.*__NAMESPACEthere are over 100 results@trigger_error\(.*self::there is only 1 existing resultSo it makes more sense to leave it the way it is.
Comment #129
tim.plunkettYeah I think those 174 instances are wrong, but let's be consistent here.
Thanks @tedbow!
Comment #133
catchPatch 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!
Comment #134
xjmGreat work, thank you!
Published the CR.
Comment #135
rpsu@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).
Comment #136
xjmAdding 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.
Comment #137
xjmAh, I see you fixed it already. :)