Problem/Motivation

DomainSourceActionBase::buildConfigurationForm() renders the domain_id setting as a checkboxes element, but everything else expects one domain id: the action.configuration.domain_source_set_action schema types it as a string, DomainSourceSet::execute() uses it as an array key and as the field value, and calculateDependencies() concatenates it into a config name.

A checkboxes element always submits an array, so any configuration built through the form, for example by Views Bulk Operations, stores something like ['one_example_com' => 'one_example_com', 'example_com' => 0]. Running the action then fails: with Domain Access installed, isset($node_domains[$id]) throws a TypeError on the array offset, and without it the array is written into the single-value field_domain_source. The dependency calculation also raises an "Array to string conversion" warning and records a dependency on domain.record.Array.

The actions created automatically for each domain (domain_source_set_action.domain_id) are not affected, because they are saved with a string id and never go through the form.

Steps to reproduce

With Views Bulk Operations, add the "Set domain source" action to a content view, select a node, pick a domain in the action form and execute it.

Proposed resolution

Render domain_id as radios, which submit the single id the schema, execute() and calculateDependencies() already expect, and add a kernel test that submits the configuration form through the form builder and asserts the stored value is that one id.

Remaining tasks

Backport to 3.x, which carries the same form.

AI-Generated: Yes (Claude Code was used to find the defect, to draft this issue summary and to write the fix and its test on the merge request. I reviewed them before posting, and the test fails on 4.x without the fix.)

Issue fork domain-3627950

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

mably created an issue. See original summary.

mably’s picture

Status: Active » Needs review

  • mably committed a5281602 on 4.x
    fix: #3627950 The Set domain source action stores a list of domains...

  • mably committed 1da2e1c1 on 3.0.x
    fix: #3627950 The Set domain source action stores a list of domains...

  • mably committed 4b092936 on 3.x
    fix: #3627950 The Set domain source action stores a list of domains...
mably’s picture

Status: Needs review » Fixed

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.