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.

Command icon 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

mogtofu33 created an issue. See original summary.

mogtofu33’s picture

pdureau’s picture

buildInstanceForm(array $options = []), with array{mandatory?: bool, title?: \Drupal\Core\StringTranslation\TranslatableMarkup|null, link?: bool}, same defaults. Replaced outright before RC1, with a change record. The three callers pass named keys.

The 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?

getTranslationLanguages(bool $include_default = TRUE), with a default in DisplayBuildablePluginBase: the default language only.

DisplayBuildableInterface::getTranslationLanguages() is already implemented in EntityViewOverride and ConfigBuildablePluginBase. Why would be the usage of this default? As an helper when creating future buildable plugins?

What does it means for TestDisplayBuildablePlugin?

isTranslationSynchronized() removed: nothing calls it.

Indeed. It was already a concern before we merged it in #3555110: Symmetric translation. Let's remove it.

mogtofu33’s picture

Title: DisplayBuildableInterface: an options array for buildInstanceForm(), a default for getTranslationLanguages() » DisplayBuildableInterface: remove isTranslationSynchronized(), type the getTranslationLanguages() flag
Assigned: Unassigned » mogtofu33
Issue summary: View changes
Status: Active » Needs work

You'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.

mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
Status: Needs work » Needs review
pdureau’s picture

Assigned: Unassigned » mogtofu33
Status: Needs review » Reviewed & tested by the community

Ok for me

  • mogtofu33 committed 49fe9b2c on 1.0.x
    task: #3635823 DisplayBuildableInterface: remove...
mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
Status: Reviewed & tested by the community » Fixed

Thanks.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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