As the admin user (uid=1):
- I created the primary domain
- I created the secondary domain
- I selected the secondary domain and logged in as the admin user (uid=1)
- I verified that the admin user has Domain Access to all domains, and is Domain Administrator for all domains
- I create a new Content Type - the Domain Access fields are automatically added to the list of fields along with Body
- I attempt to create new Content of new Content Type, but Domain Access fields are missing
- Content shows in wrong domain because I can't set Domain on creation
- I created 2 new Content Types trying to cause something different but got identical results
- I noticed that under "Manage form display" the Domain fields were in the Disabled section, but enabling them had no effect
- I also made all Domain fields Required
-- this caused the new content not to save due to missing "Send to all affiliates" (required makes boolean fields only valid when checked)
-- when the form reloaded with the error, the "Send to all affiliates" field was now visible
-- I set the "Send to all affiliates" field, and the form returns with an error about the source domain, but no additional fields are available
I am using:
- Drupal 8.5.0
- PHP 7.2.3
- MySQL 5.7.21
- Inline Form Errors (core) is enabled - currently can't disable for some reason
- Trusted Host Settings not currently configured
- All Domain module that come with Domain Access are enabled
- "Move Domain Access fields to advanced node settings" is enabled (I also tried an iteration with this setting disabled)
- Everything else is default
Adding Domain settings to new Content Types seems like basic functionality, so I'm not sure if I'm doing something completely dumb, or if there's something about this module or Drupal 8 that I'm missing.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 2953168-da-form-display-13.patch | 3.77 KB | agentrickard |
| #12 | Screenshot 2018-03-15 14.14.57.png | 57.77 KB | arnaldop |
| #11 | Screenshot 2018-03-15 13.43.08.png | 137.26 KB | arnaldop |
| #11 | Screenshot 2018-03-15 13.42.37.png | 79.61 KB | arnaldop |
| #11 | Screenshot 2018-03-15 13.42.19.png | 94.27 KB | arnaldop |
Comments
Comment #2
agentrickardThis is a lovely bug report. Thank you.
Comment #3
agentrickardSo there are two things here that don't make sense to me:
* I noticed that under "Manage form display" the Domain fields were in the Disabled section
That simply should not be true but it is. That seems to be something new with 8.5, which I was able to confirm as a bug.
* Enabling them had no effect
When I added them under the Form settings, they do appear as expected.
They are (by default) in the right rail. See attached.
What does your form display?
Comment #4
agentrickardComment #5
agentrickardThis is an odd report, since we have a test for this behavior: DomainAccessElementTest. However that test does not cover the creation of new content types.
Did you create these content types in the UI or from a configuration import?
Comment #6
arnaldopKen,
My right rail looks exactly like yours but without the "Domain Settings" section.
After the form returns with the error, I do get the "Domain Settings" but it only shows the "Send to all affiliates" checkbox.
Even after checking it, when the form returns with errors for the other 2 Domain Settings (which I now made required just for testing), they still do not show up.
I am creating all of my content by hand. It's a POC of sorts, so it's all manual for now.
Thanks!
PS: For the benefit of visuals, I added a couple of screenshots that basically show what I've already described.
Comment #7
arnaldopQuick additional note: I visited Basic Page and Article. Creating content for either of those types does show the Domain fields.
So the module is handling existing Content Types, but it's failing when new Content Types are created after Domain has already been installed.
Comment #8
agentrickardRight. I'm able to reproduce issue 1 -- fields are set to disabled -- that seems to be because the form display settings haven't been created for the node type yet.
I am not, however, able to reproduce issue 2. I can manually set the fields just fine.
What does your Form Display configuration look like?
Comment #9
agentrickardHere is a patch that seems to be working for me locally. It appears that the form_display object hasn't been created yet when hook_node_type_insert() fires, so we can also fire on hook_entity_form_display_insert().
I should write an automated test for this as well.
You will need to rebuild cache after applying the patch (
drush cr).Comment #10
agentrickardComment #11
arnaldopOk, I attached screenshots to answer your question.
Note that for Form Display, all Domain fields are not Disabled.
However, for my initial Content Type of Job Opening, this screenshot applies. Here the Display settings show that the Domain fields are not Disabled.
But for my further tests, I created a Content Type of Test2 that has Domain Access fields set to Display disabled. See here.
I hope this makes sense. I'll try the patch in a few moments. Thanks!
Comment #12
arnaldopKen,
Steps:
- I added the patch to composer.json
- I ran composer update
-- I could see the patch was applied in the composer output
- I refreshed the cache
- I created a new Content Type and did not customize it at all
- Immediately after creating it, I attempted to create new Content of that Type
I got this:

This looks much better.
Now for my newb-ness:
- How is the Domain Source field used?
- Is it for creating content via one Domain but creating it in another Domain?
- Is this purely cosmetic for those managing content?
-- In other words, if I go to site "A" and create content with Domain Source set to site "B", is this the equivalent of going to site "B" and creating the content there?
Thanks so much!
Comment #13
agentrickardAnd here's a patch with a passing test (which fails without the new hook).
Comment #14
agentrickardDomain Source comes with a README file:
Comment #15
arnaldopThanks for all your help!
Glad I met you at the DrupalCamp in Orlando last month!
Comment #17
agentrickardComment #19
jesteban commentedHi, i have same issue but with Drupal 9, when I add a Other Content Type (Not a basic page), on Domain Settings only shows the "Send to all affiliates" checkbox but don´t show a list with domains, but if i adding a Basic Page content work fine, I implemented the patch and it stiill not workin, anyone have idea? Thank a lot.
Comment #20
hongqing commentedThere is the same bug in version 2.0 with D 10.
Comment #21
steffenr@hongqing Since the issue was closed 5 years ago, it would make more sense to create a new issue and add the old one as a relation.
Please update your environment and add steps to reproduce etc..
Comment #22
ippy commentedI know its closed but as I came here with a similar problem I wanted to leave a quick comment in case anyone else is hunting and has the same cause...
On a site with three Domain records, one content type "started" displaying only the "Send to all affiliates" option and failing to save without a source domain.
As it happens it is the last CT to be created on the site, but that was like 6 years ago, so not exactly "new".
After following various threads, on my third visit to the form display structure I finally noticed that the widget for both Domain Access and Domain Source on this CT had been set to "Autocomplete". What? Clearly that will never work. (Smacks head.) Switching back to radio/button widget "fixed" the issue.
All content of this type is missing its Domain source info. Resaving each node (now that is possible) reinstates the values. Bulk assignment via content admin ("add content to ABC domain") not helpful here/does not set both access and source info.
The only real mystery for me is how/why the widget had changed. The site was developed in D8 ~6 years ago and was migrated to Drupal 9 within the past 6-9 months. The client can't edit the CT form display settings and I know I haven't. However, as nobody has edited content of this type for 3+ years I can't narrow down when it "started".