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.
Updated: Comment #0
Problem/Motivation
Currently "manage view" and "manage form display" are limited to "configurable" field types
But there's a set of Core\Field\* field types that can't be re-used because they are not configurable
Proposed resolution
Allow this screens to manage all field types, allow to configure fields for #2010930: [META] Apply formatters and widgets to rendered entity base fields (all besides node.title)
Remaining tasks
just need to find a way to display fields that have no allowed formatter/widget
User interface changes
more fields to configure
API changes
no
Comment | File | Size | Author |
---|---|---|---|
field-configure.patch | 737 bytes | andypost | |
Comments
Comment #1
andypostComment #2
andypostComment #3
yched CreditAttribution: yched commentedYes, that's an omission from #2144919: Allow widgets and formatters for base fields to be configured in Field UI.
It worked so far because node.title is still the only base field that uses widgets / formatters, and it uses 'text' field type, which happens to be "configurable".
Comment #4
BerdirI was a bit confused what this actually does, but apparently it is only used to read the default widget and formatter from the field type info right now? So should't have any visible affect until we actually start adding widgets and formatters to more base fields. There's also not much that could be tested due to that...
Comment #5
yched CreditAttribution: yched commentedYes, earlier on, the "Manage fields" page was a subclass of DisplayOverviewBase, and it used $this->fieldTypes to build the list of available field types for the "add new field" UI. Thus, it had to be limited to "configurable field types".
That's not the case anymore, and DisplayOverviewBase::$fieldTypes has a much narrower use now. And yes, that use now covers all field types, not just "configurable" ones.
Comment #6
webchickNeeds test coverage, IMO. While we might get some anecdotal test coverage out of #2144919: Allow widgets and formatters for base fields to be configured in Field UI, this is part of the base field API, so we should be able to validate it independently.
Comment #7
andypostHere is a test
Comment #8
andypostPatch with missed new test.
Comment #11
yched CreditAttribution: yched commentedHonestly, I'd rather not do that.
This can't be tested right now because no widgets / formatters exist ATM that can be applied to field types that are not also "configurable fields types". Historically, only "Field API fields" have widgets & formatters, and currently that's still the case.
That will change at some point, but right now I'd rather not introduce weird / artificial alters in a test module to create conditions we don't have. It only makes the test suite harder to maintain.
@webchick : I'd ask to reconsider committing the fix alone.
Comment #15
andypostRemove unused changes in entity_test, just more alters. Agree with @yched but otoh we could re-use this code and test latter
The following change is needed to properly test field admin tabs
This is needed to not duplicate tabs for field ui (bug introduced in #2144919: Allow widgets and formatters for base fields to be configured in Field UI
Comment #18
andypost@berdir suggested fix in IRC, let's see what bot say
Comment #20
andypost18: 2191555-base-fields_in_field-ui-16.patch queued for re-testing.
Comment #21
BerdirI have still no idea why we're not doing this by default, in text.module :)
node.title uses text just to have a formatter/widget but that means it also has a format in the schema, which will get in the way when trying to generate the schema.
But certainly better already, if we can make it work.
Comment #22
andypost@Berdir we can't because first we need to unify constraints, that happens in #2002168: Convert form validation of terms to entity validation now
Comment #23
yched CreditAttribution: yched commentedAs stated earlier, I'd really rather avoid adding those here. This is not the issue for that. If we want to make those widgets / formatters run on 'string' fields, that's a separate issue.
Still +1 on committing the fix alone.
Comment #24
BerdirThe issue in #23 has been committed, but ok yes, let's either get the fix in without test coverage instead of altering something to together *or* close the issue, create a new one to make node.title and the test entity use string, make sure that it works and as part of that, fix the bug here.
Comment #25
andypostSo I'm hidding all patches except #0
Comment #26
alexpottI think we should do this as part of #2010930: [META] Apply formatters and widgets to rendered entity base fields (all besides node.title) so that we have have tests.
Comment #27
BerdirSee #2198917: Use the string field type for the node title field, based on this issue, I'd expect that to fail because of this bug, so let's see what happens.