Overview

Discovered at https://git.drupalcode.org/project/canvas/-/merge_requests/882#note_760120
For the component instance form of SDCs and code components, we need to know the label.

Currently, the logic for that is hardcoded in \Drupal\canvas\Plugin\Canvas\ComponentSource\GeneratedFieldExplicitInputUxComponentSourceBase::buildComponentInstanceForm().

Which means it's not available for translation.

Proposed resolution

  1. Add ComponentSourceInterface::getLabelForExplicitInput().
  2. Refactor GeneratedFieldExplicitInputUxComponentSourceBase::buildComponentInstanceForm() to use it.

(Similar to ::getOptionsForExplicitInputEnumProp(), and clearly complementary to ::getExplicitInput()).

User interface changes

None.

Issue fork canvas-3586490

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

wim leers created an issue. See original summary.

wim leers’s picture

Assigned: Unassigned » wim leers
Issue tags: +AI-accelerated

Trying to get this simple one knocked out by AI while I work on something else.

wim leers’s picture

Assigned: wim leers » tedbow
Status: Active » Needs review

Now should have failures for some of the component sources, but is well on its way.

WDYT about the direction, @tedbow?

wim leers’s picture

Status: Needs review » Needs work

tedbow made their first commit to this issue’s fork.

wim leers’s picture

For the record: the pretty crappy initial implementation AI did cost $10.367. It used 48 Opus 4.6 requests ($5.79), 323 Haiku 4.5 requests ($4.58). The result is poor.

wim leers’s picture

Status: Needs work » Needs review
wim leers’s picture

Title: Introduce `ComponentSourceInterface::getLabelForExplicitInput()` » Introduce `ComponentSourceInterface::getLabelForExplicitInputKey()`

One suggestion left for @tedbow to hopefully agree with — should be an easy merge 🤞

rakhimandhania’s picture