Folow-up of #2903161: Fix incorrect FieldFormatter id for "weight" field in base field definition in display options:
Re the naming, yes, that the name is different is a bit unfortunate, but that's actually quite common to have mismatches between field types, widgets and formatter plugin ID's, e.g. link has link_default widget and link formatter, string has string_textfield widget and string as formatter, string_long has string_textarea widget and basic_string as default formatter. I don't think we need to change that, we don't really have a BC system for plugin ID's. But maybe instead we could add stricter, earlier validation, so that when you use an invalid type when defining a base field, it throws an exception immediately with helpful context?
The idea is to throw an exception when using a non-existing type in a base field definition. Although we have to be careful about that as it could technically be a BC break for some cases, as it currently *works*, it just starts to get weird when exported into a display configuration entity and then later on validated there. For actually displaying, it will automatically fall back to the default.
So maybe in 8.x it shoud be a trigger_error(), with an actual exception in 9.x?
Comments
Comment #13
smustgrave commentedThank you for creating this issue to improve Drupal.
We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!