- ๐บ๐ธUnited States smustgrave
getLabel should be typehinted as a new function.
Also some test coverage will be needed
Thanks!
- Status changed to Needs review
about 1 year ago 2:22pm 25 November 2023 - ๐ป๐ณVietnam phthlaap
I've added a test for the getLabel method. I would appreciate your assistance in reviewing it.
Thank you.
- last update
about 1 year ago 30,676 pass - Status changed to Needs work
about 1 year ago 5:13pm 25 November 2023 - ๐บ๐ธUnited States smustgrave
#13 I should of also tagged for a change record. Can be super simple.
Recommend turning patch to MR as patches are going away.
- Merge request !5550Move the changes from patch 3128190-15.patch to a Git merge request. โ (Open) created by phthlaap
- ๐ป๐ณVietnam phthlaap
I have created a merge request. Could you please take a look and let me know if everything is in order?
- Status changed to Needs review
about 1 year ago 2:20am 26 November 2023 - Status changed to Needs work
about 1 year ago 6:13pm 26 November 2023 - ๐บ๐ธUnited States smustgrave
Removing tests tag as they have been added and can be seen in the test-only feature
There was 1 failure: 1) Drupal\KernelTests\Core\Field\FieldItemTest::testFieldItemDataDefinitionReturnLabel Failed asserting that null matches expected 'Text (plain)'. /builds/issue/drupal-3128190/vendor/phpunit/phpunit/src/Framework/Constraint/Equality/IsEqual.php:94 /builds/issue/drupal-3128190/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php:109 /builds/issue/drupal-3128190/vendor/phpunit/phpunit/src/Framework/TestResult.php:728 FAILURES! Tests: 2, Assertions: 31, Failures: 1.
Believe the last thing to do is draft a change record.
Updated issue summary too with the correct template
- Status changed to Needs review
about 1 year ago 11:02pm 26 November 2023 - ๐ป๐ณVietnam phthlaap
Please help to review change record https://www.drupal.org/node/3404250 โ
- Status changed to RTBC
about 1 year ago 3:42pm 27 November 2023 - ๐ณ๐ฟNew Zealand quietone
I'm triaging RTBC issues โ . I read the IS and the comments, the MR and the Change record.
Thanks for working on this feature!
Overall, the change is working but there is some more things to do to finish this.
- There is a comment in the MR that this has an out of scope change.
- The test should also test when there is a label.
- The change record should explain what the return value will be when there is a label and when there is not. Currently, it is a misleading.
Back to needs work for a few more things.
- Status changed to Needs work
about 1 year ago 8:26am 24 December 2023 - ๐ฎ๐ณIndia prashant.c Dharamshala
Prashant.c โ made their first commit to this issueโs fork.
- ๐ฎ๐ณIndia prashant.c Dharamshala
- There is a comment in the MR that this has an out of scope change
- The test should also test when there is a label.
It is there https://git.drupalcode.org/project/drupal/-/merge_requests/5550/diffs#dc...
- The change record should explain what the return value will be when there is a label and when there is not. Currently, it is a misleading.
Still pending
DONE
- Status changed to Needs review
12 months ago 5:05pm 5 January 2024 - ๐ป๐ณVietnam phthlaap
I resolved all items in comment #23. Please help to review.
- Status changed to RTBC
12 months ago 5:20pm 7 January 2024 - Status changed to Needs work
11 months ago 5:56am 5 February 2024 - ๐ณ๐ฟNew Zealand quietone
I left two suggestions in the MR to simply method name and a comment.
- ๐ฎ๐ณIndia keshav patel
Keshav Patel โ made their first commit to this issueโs fork.
- Status changed to Needs review
11 months ago 6:25am 8 February 2024 - ๐ฎ๐ณIndia keshav patel
Updated the method name and comment as per #29, Please review.
- Status changed to RTBC
11 months ago 4:09pm 9 February 2024 - ๐ฌ๐งUnited Kingdom alexpott ๐ช๐บ๐
Committed and pushed 94b03bcdec to 11.x and 973d283bea to 10.3.x. Thanks!
This is almost a bug...
We cannot add a return type here. This would break contrib code that extends this class and overrides the method already.
diff --git a/core/lib/Drupal/Core/Field/TypedData/FieldItemDataDefinition.php b/core/lib/Drupal/Core/Field/TypedData/FieldItemDataDefinition.php index 2cd2137b0e..2604eec502 100644 --- a/core/lib/Drupal/Core/Field/TypedData/FieldItemDataDefinition.php +++ b/core/lib/Drupal/Core/Field/TypedData/FieldItemDataDefinition.php @@ -98,7 +98,7 @@ public function setFieldDefinition($field_definition) { * * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException */ - public function getLabel(): string { + public function getLabel() { return parent::getLabel() ?: $this->getTypedDataManager()->getDefinition($this->getDataType())['label']; }
Fixed on commit.
-
alexpott โ
committed 973d283b on 10.3.x
Issue #3128190 by phthlaap, Keshav Patel, msuthars, sja112, rlmumford,...
-
alexpott โ
committed 973d283b on 10.3.x
- Status changed to Fixed
10 months ago 11:35am 2 March 2024 -
alexpott โ
committed 94b03bcd on 11.x
Issue #3128190 by phthlaap, Keshav Patel, msuthars, sja112, rlmumford,...
-
alexpott โ
committed 94b03bcd on 11.x
- ๐ฌ๐งUnited Kingdom alexpott ๐ช๐บ๐
After committing I wonder if we should push this fix to the parent class and make the following change...
diff --git a/core/lib/Drupal/Core/TypedData/DataDefinition.php b/core/lib/Drupal/Core/TypedData/DataDefinition.php index a82f819b4c..c4acc004ec 100644 --- a/core/lib/Drupal/Core/TypedData/DataDefinition.php +++ b/core/lib/Drupal/Core/TypedData/DataDefinition.php @@ -72,7 +72,7 @@ public function setDataType($type) { * {@inheritdoc} */ public function getLabel() { - return $this->definition['label'] ?? NULL; + return $this->definition['label'] ?? $this->getTypedDataManager()->getDefinition($this->getDataType())['label'] ?? NULL; } /**
And remove the override in FieldItemDataDefinition
Can someone file a follow-up to do this?
Automatically closed - issue fixed for 2 weeks with no activity.
- ๐ป๐ณVietnam phthlaap
As @alexpott suggestion, I moved code to parent class but I dont know how to fix the test failed.