Provide the 'general' category within the plugin manager, and ensure that it remains unaltered

Created on 24 August 2023, over 1 year ago

Problem/Motivation

In the parent issue 📌 Allow field_type_categories.yml entries to define asset libraries Fixed there are multiple instances where we check for fallback category. It can be eliminated by always providing the general category in the the plugin manager and making sure that it remains unaltered.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Fixed

Version

11.0 🔥

Component
Field UI 

Last updated 9 days ago

Created by

🇮🇳India srishtiiee

Live updates comments and jobs are added and updated live.
  • Field UX

    Usability improvements related to the Field UI

Sign in to follow issues

Comments & Activities

  • Issue created by @srishtiiee
  • Status changed to Needs review over 1 year ago
  • last update over 1 year ago
    30,058 pass
  • 🇷🇴Romania amateescu

    Could be as simple as this :)

  • Status changed to RTBC over 1 year ago
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    @amateescu LGTM!

    P.S.: I do think it's still slightly confusing, but this is out of scope. What do you think, @amateescu and others?

    +++ b/core/lib/Drupal/Core/Field/FieldTypeCategoryManager.php
    @@ -79,6 +79,17 @@ protected function getDiscovery(): YamlDiscovery {
    +    if (!isset($definitions[FieldTypeCategoryManagerInterface::FALLBACK_CATEGORY])) {
    +      throw new \LogicException('Missing fallback category.');
    
    +++ b/core/modules/comment/comment.module
    @@ -789,9 +789,7 @@ function comment_entity_view_display_presave(EntityViewDisplayInterface $display
    +  // The `comment` field type belongs in the `general` category, so the
    ...
    +  $definitions[FieldTypeCategoryManagerInterface::FALLBACK_CATEGORY]['libraries'][] = 'comment/drupal.comment-icon';
    

    This is the thing that makes it confusing IMHO: the constant says "fallback", but it's really the "general" category.

    Renaming the constant would make this clearer.

    And we can still do that because this didn't ship in any release!🤞🤓

    • lauriii committed 1ea295c8 on 11.x
      Issue #3383080 by amateescu, srishtiiee, Wim Leers: Provide the 'general...
  • Status changed to Fixed over 1 year ago
  • 🇫🇮Finland lauriii Finland

    I think we called it a fallback category because it has some special functionality, see \Drupal\Core\Field\FallbackFieldTypeCategory. It's also not rendered like other categories. Items in this category are rendered on their own, without a category, meaning it's not a real category. If we want to consider renaming or changing it, let's do that in a follow-up issue.

    Committed 1ea295c and pushed to 11.x. Thanks!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024