- 🇧🇪Belgium tim-diels Belgium 🇧🇪
After testing, I'm not seeing the "Set" action for existing domains. These should be handled in the install function also and not only in the update function?
Also a small PHPCS issue with a t() that should be a $this-t() and another small PHPCS issue.
The tests are not that easy to add, so leaving that open and adding the issue tag.
Setting this to NR for the changes, can be set back to NW afterwards for the tests. - 🇪🇸Spain guardiola86
The patch is working for me. After running updates and clearing the cache, I can set the source origin. The only thing is that the domain must be already checked in Domain Access, which is correct.
- Status changed to Needs work
7 days ago 10:06pm 16 August 2025 - Merge request !194Issue #3048808 by vflirt, slbrassard, mably: Set domain source action → (Merged) created by mably
- 🇫🇷France mably
Simple test added. Looks like we are ready for merge.
/** * Tests the domain source actions. * * @group domain */ class DomainSourceActionsTest extends DomainTestBase { /** * {@inheritdoc} */ protected static $modules = [ 'domain', 'domain_access', 'domain_source', 'field', 'node', 'user', ]; /** * Tests bulk actions through the content overview page. */ public function testDomainSourceActions() { $perms = [ 'access administration pages', 'access content overview', 'edit any article content', ]; $admin_user = $this->drupalCreateUser($perms); // Create test domains. $this->domainCreateTestDomains(2); // Create a test node. $node = $this->drupalCreateNode([ 'type' => 'article', 'title' => 'Test node', ]); $this->drupalLogin($admin_user); $this->drupalGet('admin/content'); // Try setting source without domain assignment. $action_id = 'domain_source_set_action.example_com'; $edit = [ 'node_bulk_form[0]' => TRUE, 'action' => $action_id, ]; $this->submitForm($edit, 'Apply to selected items'); // Check that we have the right warning on page. $this->assertSession()->pageTextContains('Content 1 must be assigned to domain example_com'); // Try bulk assigning the domain to our node. $action_id = 'domain_access_add_action_example_com'; $edit = [ 'node_bulk_form[0]' => TRUE, 'action' => $action_id, ]; $this->submitForm($edit, 'Apply to selected items'); // Retry setting the domain source after the domain assignment. $action_id = 'domain_source_set_action.example_com'; $edit = [ 'node_bulk_form[0]' => TRUE, 'action' => $action_id, ]; $this->submitForm($edit, 'Apply to selected items'); // Check that we do not have the previous warning on page. $this->assertSession()->pageTextNotContains('Content 1 must be assigned to domain example_com'); // Check that the domain source have been properly set. $node_storage = \Drupal::entityTypeManager()->getStorage('node'); $node = $node_storage->load(1); // Check that the value is set. $value = domain_source_get($node); $this->assertEquals('example_com', $value, 'Node saved with proper source record.'); } }