Generated with the help of an LLM.
Problem/Motivation
Child of #3624396: Plan: Harden InstanceInterface, IslandInterface and DisplayBuildableInterface as public API before RC1.
isTranslationSynchronized() has no caller, and its docblock names a data field that is sources.
getTranslationLanguages() takes an untyped flag.
No page of the docs explains how to write a buildable.
buildInstanceForm() keeps its typed parameters, as discussed in #3635823-4: DisplayBuildableInterface: remove isTranslationSynchronized(), type the getTranslationLanguages() flag: nothing overrides it, and named arguments make its callers readable.
Proposed resolution
Remove isTranslationSynchronized(), type the flag as bool $include_default = TRUE, and pass named arguments in the three buildInstanceForm() callers.
Add docs/buildable-plugins.md: both base classes, the configuration a plugin is built from, collectDisplays(), the read-only rule and the override interface.
Remaining tasks
- MR.
- Change record section for the removal.
User interface changes
None.
API changes
isTranslationSynchronized() is removed from DisplayBuildableInterface and DisplayBuildablePluginBase.
getTranslationLanguages() types its flag. An untyped implementation stays compatible.
Data model changes
None.
Issue fork display_builder-3635823
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mogtofu33 commentedComment #3
mogtofu33 commentedComment #4
pdureau commentedThe proposal is to replace a set of parameters
(bool $mandatory, ?TranslatableMarkup $title, bool $link)by a single(array $options)? Why? Is it because all parameters are optional?DisplayBuildableInterface::getTranslationLanguages()is already implemented inEntityViewOverrideandConfigBuildablePluginBase. Why would be the usage of this default? As an helper when creating future buildable plugins?What does it means for
TestDisplayBuildablePlugin?Indeed. It was already a concern before we merged it in #3555110: Symmetric translation. Let's remove it.
Comment #5
mogtofu33 commentedYou're right on both.
Named arguments give the callers the readability an options array would, and keep the types: nothing overrides `buildInstanceForm()`, so I keep its signature and only switch the three callers to named arguments.
For `getTranslationLanguages()`, a default would only spare `TestDisplayBuildablePlugin` one method, and a buildable storing in a content entity should decide its translations rather than inherit "default language only", so no default, just a `bool` on the flag.
That leaves the removal of `isTranslationSynchronized()` as the only break before RC1; I'll update the summary and title.
Comment #7
mogtofu33 commentedComment #8
pdureau commentedOk for me
Comment #10
mogtofu33 commentedThanks.