OK - this is reproducible using block_class, but there may be other ramifications here.
Create a block, assign it to the appropriate site/theme in block layout, adding a class. Save.
Configure block. Add another class. Save. Note that the class isn't saved.
Remove the block. Try to add it back, including the desired classes. (The class field will be blank.) Save.
Error: The website encountered an unexpected error. Please try again later.
Log: The machine-readable name is already in use. It must be unique.
Go to block layout where you will, indeed, see the block. Configure the block in question. Note that updated settings are, indeed, changed.
So even though you can get around this, I'd still suggest that it's major. Any suggestions greatly appreciated... thanks!
P.S. - Order also doesn't save, even if using weight. Weight for all blocks in region reverts to 0.
UPDATE: Not sure where the problem is, so to be fair, I also posted a link to this thread on the Block Class issue queue: https://www.drupal.org/project/block_class/issues/3377455
Comments
Comment #2
bcobin commentedComment #3
bcobin commentedComment #4
ravi kant commented@bcobin
I am using block class module regularly and same as you explained but never get this type error.
Can you share the detailed error message? Use
$config['system.logging']['error_level'] = 'verbose';in setting.php or setting.local.php for it.I think there is some other broken issue which will debug with detailed error message. Also you may check "Recent log messages" for detailed error message.
Comment #5
bcobin commentedThanks, Ravi! See below - there are three errors in the log for each failure.
---
UPDATE: After posting this (from earlier errors), I tried again. No errors this time, but here's what happens:
1. Create block, including class and save.
2. Edit block, note that class is intact.
3. Add an additional class - save.
4. Edit block - the added class is gone.
----
Something occurs to me: I'm using a Bootstrap 5 subtheme for all affiliates; theme structure is:
themes > custom > subtheme > config > optional > block.block.[subtheme_name]_[various].yml
For each affiliate theme, I'm copying an existing theme and changing the name and content of the .yml file accordingly.
Here's what I'm wondering:
Each .yml file declares a specific ID:
Note the ID under settings. (In this case, id: 'system_menu_block:account')
I haven't changed these IDs. So although the names are different for each affiliate, could the errors be on account of the same id (in this case, 'system_menu_block:account') being used across several sites?
I don't see how this could/should affect custom blocks, though. In any event, below are the error messages. Thanks for reaching out - greatly appreciated!
Error #1:
Error #2:
Error #3:
Comment #6
bcobin commentedOK - here's what happens:
1. Change a block setting and save. (In this case, it was display or override title.)
2. Note that setting doesn't save.
3. Remove any title setting from block and save.
Result: Website reported an unexpected error. (Errors 1 and 2 from above.)
4. Delete block
Result: Website reported an unexpected error. (Error 3 from above.)
5. Re-assign block with desired settings and save.
Result: Success!
So there is a workaround, if you can deal with the error messages.
Any ideas? Thanks!
Comment #7
mably commented