Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow-up from #2225739: Remove usage of field_info_instances(), use EntityManager::getFieldDefinitions() instead.
This function no more needed because field has getLabel()
method
$ git grep field_views_field_label
core/modules/field/field.views.inc:80:function field_views_field_label($entity_type, $field_name) {
core/modules/field/field.views.inc:185: list($label, $all_labels) = field_views_field_label($entity_type_id, $field_name);
core/modules/file/file.views.inc:510: list($label) = field_views_field_label($entity_type_id, $field_name);
core/modules/image/image.views.inc:45: list($label) = field_views_field_label($entity_type_id, $field_name);
core/modules/taxonomy/taxonomy.views.inc:443: list($label) = field_views_field_label($entity_type_id, $field_name);
Only field.views.inc:185
needs some clean-up
Comment | File | Size | Author |
---|---|---|---|
#9 | drupal8-remove_field_views_field_label-2231863-9.patch | 5.09 KB | Jalandhar |
#5 | drupal8-remove_field_views_field_label-2231863-5.patch | 4.89 KB | Jalandhar |
Comments
Comment #1
tim.plunkettComment #2
BerdirYes, it is needed.
Fields don't have a label, their getLabel() implementation returns the field name.
The views function attempts to display the best label by looking at the field instances for that field and picks the most frequently looked label.
Comment #3
Jalandhar CreditAttribution: Jalandhar commentedUpdating the patch which fixes the issue(Used get label method instead of field_views_field_label() in field.views.inc:185). Please review it.
Comment #5
Jalandhar CreditAttribution: Jalandhar commentedUpdating the patch with required changes. (Removed field_views_field_label() and replaced its function calls with getLabel() in all occurrences as said in the description of issue.)
Please review.
Comment #6
mashermike CreditAttribution: mashermike commented5: drupal8-remove_field_views_field_label-2231863-5.patch queued for re-testing.
Comment #8
mashermike CreditAttribution: mashermike commentedThis patch no longer applies because in commit cda250396e4f501328ddbd5b69dd971bef2d70c2 the field_views_field_label function was modified. This patch moves that block of code to a new location. If this patch is going to be rerolled that modification needs to be ported to the new location in the patch.
Comment #9
Jalandhar CreditAttribution: Jalandhar commentedUpdating the patch with reroll. Please review.
Comment #10
BerdirSee #2, I think this issue is wrong and should be won't fixed, we still need this function.
Comment #11
BerdirThat is, unless we want to move the logic into FieldConfig::getLabel(), but I'm not sure about that. It would be useful because other places need this too, for example comment.module has similar code snippet but only looks at the first one.
Comment #12
andypostI suppose better to refactor usage of the function - there's only few places to fix,
Also this could be done after #2183231: Make ContentEntityDatabaseStorage generate static database schemas for content entities
Comment #13
dawehnerPardon, but I don't see why not having all that logic in a separate function is not a good idea in the first place?
Comment #14
xjmRemoving the Novice tag until there is consensus.
Comment #15
Mile23field_views_field_label()
was changed toviews_entity_field_label()
.Change record: https://www.drupal.org/node/2402215