Closed (fixed)
Project:
Drupal core
Version:
11.2.x-dev
Component:
node system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 Nov 2019 at 07:03 UTC
Updated:
18 Jun 2025 at 18:06 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
krystalcode commentedComment #3
kim.pepperLet's trigger the testbot by marking needs review.
Comment #4
joachim commentedLooks good overall, just a nitpick:
Those changes seem unrelated to me.
Comment #5
felribeiro commentedComment #7
felribeiro commentedComment #8
hardik_patel_12 commentedRemoving unused Drupal\Core\StringTranslation\TranslationInterface and unused $this->stringTranslation service injection it is not used in file.
Using \Drupal\Core\Entity\EntityStorageInterface instead of Drupal\Core\Config\Entity\ConfigEntityStorageInterface for injecting $this->nodeTypeStorage services.
Fixing some drupal standards error also, Kindly review a new patch.
Comment #10
hardik_patel_12 commentedRemoving unused Drupal\Core\StringTranslation\TranslationInterface and unused $this->stringTranslation service injection it is not used in file.
Fixing some drupal standards error also for patch at #7 , Kindly review a new patch.
Comment #11
hardik_patel_12 commentedComment #12
vivek panicker commentedWill review the patch and provide feedbacks/updates if necessary.
Comment #13
vivek panicker commentedMade compatible to coding standards issue.
Comment #14
vivek panicker commentedComment #15
hardik_patel_12 commented@vivek Panicker , kindly upload interdiff also along with the patch whenever you do some changes in patch. It will be helpful for other to track what's exactly changes done.
Comment #20
ranjith_kumar_k_u commentedRerolled #13 for 9.5
Comment #21
elberI will revise it.
Comment #22
elberI'm keep revising it
Comment #23
elberI revised the reroll #25 I applied in drupal9-9.5 version
Core keeps working as expected.
Comment #25
nitin shrivastava commented#13 patch is not applied successfully on 9.5.x , reroll for 9.5.x.
Comment #26
akram khanFixed CCF #25
Comment #27
akram khantry to fix
Comment #28
sahil.goyal commentedtrying Fix the PHPCS error
Comment #29
nivethasubramaniyan commentedFixing CCF errors
Comment #30
elberHi I applied the patch #29 after that I ran these phpcs commands :
phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml .
phpcs --standard=DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml .
I found that errors in screenshot
Comment #31
elberComment #32
elberHi everyone the lasts rerrols erased the changes previous did before. I revised the patch #20 and I was able to apply in drupal 9.5 version, and the changes were kept. You can discard the others patches that was made after patch #20, because it erased the changes of the issue.
Comment #35
xjmAs an API addition/internal BC break, this should be targeted for the development branch (currently 10.1.x).
This reordering of use statements is out of scope and also against our default pattern of having them alphabetized (so
Drupal\Coreshould come beforeDrupal\node).For BC purposes, since these objects previously would have been constructed directly instead of by the factory method, this should probably allow the entity type manager to default to
NULL. The parameter documentation should then be updated accordingly.And, if null is passed, it should load the storage conditionally using
\Drupal::entityTypeManager(), with a deprecation warning.This should be on a single line.
This comment addition is out of scope, and also seems unnecessary?
I think this needs to be changed to use the entity type manager as well? Otherwise, this will load from the default storage even if someone injects a different one, which could lead to data integrity errors.
The issue summary also says this should be done for other modules that provide permissions callbacks. Can we get a followup meta for that?
Thanks everyone!
Comment #36
xjmThis will also need a change record. Thanks!
Comment #37
ameymudras commentedFixed the code review issues specified in #35
Comment #38
ameymudras commentedThere was an issue with the above patch please ignore it
Comment #39
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #need-reveiw-queue. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge require as a guide.
Moving back to NW for the change record and follow up mentioned in #35
Comment #42
hardik_patel_12 commentedUpdated the DI in permission callbacks for TaxonomyPermissions.php, a change record is still needed.
Comment #43
joachim commented> This will also need a change record. Thanks!
I don't think this needs a CR - the class is internal. It's not even a service.
Comment #44
krystalcode commentedThe string translation service is used many times in this file, every time
$this->t()is called. TheStringTranslationTraittakes care of it if it is missing, but it's hacky and renders the class more difficult to test. It is there for cases where dependency injection is not available or for developer that do not know how to do it, but it should be injected when possible: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/lib/Drupal/Co...Comment #46
acbramley commentedRebased, updated to use autowiring and constructor property promotion, changed to not inject entity storage, added CR and deprecation message although I somewhat agree this is overkill.
Comment #47
acbramley commentedComment #48
smustgrave commentedOpened #3516433: META: Use dependency injections in permission callbacks to track others
Change here though seems pretty straightforward though, good deprecation.
LGTM
Comment #49
quietone commentedSetting to needs work for an item in the MR. Also, this needs a title update.
I see that xjm asked for a Meta to make these changes in other permission callback but I wonder if these can all be done at once. Not sure.
Comment #51
nicxvan commentedI updated the title and took care of the cr link.
Comment #52
smustgrave commentedTitle seems good now, change still looks good.
Comment #56
catchCommitted/pushed to 11.x, thanks!
I jumped the gun and deleted the CR because we don't need change records for constructor bc, then realised that we do need them because phpcs demands one for all depecation messages. I really think we need to change that requirement, but for now I made a new CR and a redirect from the old one to the new one.
Comment #58
xjmAmending attribution.