When I ran into #2584837: Double translation in template_preprocess_field_multiple_value_form() I realized \Drupal\Core\Field\BaseFieldDefinition::getLabel()
returns TranslatableMarkup object while \Drupal\Core\Field\FieldConfigBase::getLabel()
returns a string.
Docs in \Drupal\Core\TypedData\DataDefinitionInterface::getLabel()
mention string only. PHPDoc comment should be updated to include possibility of an instance of TranslatableMarkup being returned too.
Comment | File | Size | Author |
---|---|---|---|
#6 | interdiff.txt | 780 bytes | slashrsm |
#6 | 2585193_6.patch | 683 bytes | slashrsm |
#3 | 2585193_3.patch | 660 bytes | slashrsm |
#2 | 2585193_2.patch | 1.53 KB | slashrsm |
#2 | 2585193_2_TEST_ONLY.patch | 993 bytes | slashrsm |
Comments
Comment #2
slashrsm CreditAttribution: slashrsm at Examiner.com commentedAttached patch goes with the approach nr. 1. I am not sure it is the best solution, but it was easiest to show what is wrong (as it includes a test too).
Comment #3
slashrsm CreditAttribution: slashrsm at Examiner.com commentedUpdated summary and new patch based on discussion with @berdir on IRC.
Comment #5
jhodgdonGood idea to document this, thanks!
But this now reads:
Two problems: (a) The added paragraph of docs is not a sentence (has no verb). (b) Normally we would want documentation that only pertains to the return value to be part of the @return docs not a stand-alone paragraph.
Comment #6
slashrsm CreditAttribution: slashrsm as a volunteer commentedThank you for your suggestion. Fixed!
Comment #7
joelpittetThank you this looks good.
Comment #9
jhodgdonThanks! This is OK. I would have started the second sentence there with "A" but it is more or less OK as it is.
Comment #10
alexpottI added @jhodgdon's
A
on commit. Committed 5911714 and pushed to 8.0.x. Thanks!