- ๐ฌ๐งUnited Kingdom rachel_norfolk UK
Updating remaining tasks.
Removing Novice tag as it I just a bit of a long issue now.
- ๐บ๐ธUnited States smustgrave
Left some comments on the MR.
Before moving to review please take a look at the tags. Like the 12th issue today where something was skipped.
- ๐บ๐ธUnited States smustgrave
Before moving to review please take a look at the tags
- ๐ฌ๐งUnited Kingdom rachel_norfolk UK
Just to be absolutely clear, what we are looking for before setting the issue to โNeeds reviewโ is a change record. You can read about creating change records at https://www.drupal.org/community/contributor-guide/task/write-a-change-r... โ
- ๐ฎ๐ณIndia arunkumark Coimbatore
Created draft Change Request for the Field label sorting.
https://www.drupal.org/node/3477218 โ
[#3477218]Update the Change Request if any corrections are needed.
The Needs Review Queue Bot โ tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide โ to find step-by-step guides for working with issues.
- ๐ฌ๐งUnited Kingdom rachel_norfolk UK
added some alt text to the draft change record screenshots.
- ๐ฌ๐งUnited Kingdom rachel_norfolk UK
Removed Needs Change Record tag.
Ran the MR in simplytest.me and it is applying the sort order to fields, as expected.
I think we are finally good to go...
- ๐ซ๐ทFrance nod_ Lille
I think we can make this simpler.
Adding a sort in
\Drupal\Core\Entity\EntityFieldManager::getFieldMap
fixes the issue// In the second step, the per-bundle fields are added, based on the // persistent bundle field map stored in a key value collection. This // data is managed in the // FieldDefinitionListener::onFieldDefinitionCreate() and // FieldDefinitionListener::onFieldDefinitionDelete() methods. // Rebuilding this information in the same way as base fields would not // scale, as the time to query would grow exponentially with more fields // and bundles. A cache would be deleted during cache clears, which is // the only time it is needed, so a key value collection is used. $bundle_field_maps = $this->keyValueFactory->get('entity.definitions.bundle_field_map')->getAll(); foreach ($bundle_field_maps as $entity_type_id => $bundle_field_map) { foreach ($bundle_field_map as $field_name => $map_entry) { // SORT HERE ksort($map_entry['bundles']); if (!isset($this->fieldMap[$entity_type_id][$field_name])) { $this->fieldMap[$entity_type_id][$field_name] = $map_entry; } else { $this->fieldMap[$entity_type_id][$field_name]['bundles'] += $map_entry['bundles']; } } }
The result is cached so performance impact should be minimal. If we're worried we can also wrap this in a count() to sort only arrays with more than one item.
I don't think increasing the API surface for this is worth it.
- ๐ซ๐ทFrance nod_ Lille
oh but that would sort the machine names, not the labels...