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