- 🇵🇹Portugal marcofernandes
The problem is that, in order to provide the full editing experience, we have to do some alters on the node/entity edit form. But, if a theme (admin) also does alter the same form, it has priority and might override Drupal Gutenberg's changes. For example, if a theme provides a node edit form template a bit different from Claro, it is enough to break Gutenberg.
We're trying several options in 📌 Entity type agnostic Active to mitigate this issue. - 🇷🇺Russia gease Praha
Ok, since people are aware and working on that, I will not attach a patch, just a snippet from claro theme that should make custom theme work with Gutenberg (as a temporary solution)
/** * Implements hook_form_BASE_FORM_ID_alter() for \Drupal\node\NodeForm. * * Changes vertical tabs to container. */ function claro_form_node_form_alter(&$form, FormStateInterface $form_state) { $form['#theme'] = ['node_edit_form']; $form['#attached']['library'][] = 'claro/form-two-columns'; $form['advanced']['#type'] = 'container'; $form['advanced']['#accordion'] = TRUE; $form['meta']['#type'] = 'container'; $form['meta']['#access'] = TRUE; $form['revision_information']['#type'] = 'container'; $form['revision_information']['#group'] = 'meta'; $form['revision_information']['#attributes']['class'][] = 'entity-meta__revision'; }
- 🇰🇷South Korea keithkhl
Where to add that function? Guess I have to change the library 'claro/form-two-columns' to something else.
- 🇰🇷South Korea keithkhl
After setting a Bootstrap theme for default, I cannot access editor even with Claro as the admin theme (w/ editor option checked).
In the dev console, I can see that calls for files are made, and status were all 200, but the screen body got covered by the Bootstrap js.
The entity type agnostic ( https://www.drupal.org/project/gutenberg/issues/3445655 📌 Entity type agnostic Active ) should take this into account. - 🇷🇺Russia gease Praha
@keithkhl no, you don't need to change the claro/form-two-columns library
The simplest thing is to implement the same hook in your theme file (yourtheme.theme) and to call claro hook from therefunction yourtheme_form_node_form_alter(&$form, FormStateInterface $form_state) { claro_form_node_form_alter($form, $form_state); }
and declare dependency on claro in yourtheme.info.yml:
dependencies:
dependencies:
- core/claroThis is a rather dirty hack, but so far we don't have anything better.
- 🇰🇷South Korea keithkhl
@gease, thx bunch. haven't thought about that. as long as claro stays in the system, like sub-themes.
- 🇰🇷South Korea keithkhl
@gease, I've tried the function as a custom module on Gin Admin and Bootstrap 5 admin themes, but it doesnt work on either. I revert back to Claro for now.
To the team, as a long time WordPress user w/ heavy dependence to Gutenberg, I deeply appreciate the hard work on this. However, with current setting, I become wary of every single module potentially discharge me from node editor with Gutenberg.
Whatever the functional mod to the admin theme is implemented, like experimental navigation bar module for example, I cannot use Gutenberg editor anymore.
I can further customize CSS on a Claro sub theme for UI, but I would much appreciate if there is an official sub module that overrules each theme's node editor customization. At least it was like that with WordPress by default.
- 🇰🇷South Korea keithkhl
@gease, I fixed it. Don't know why, but dependency to 'claro' did not read the theme. I added the full function into the code. So, as long as Claro is not removed, the function should work. I've confirmed a number of admin themes (Gin admin, Bootstrap admin, and D10's administration theme). Attached the 'dirty hack', in case anyone get in trouble like me.
- 🇷🇺Russia gease Praha
I made a mistake in previous comment, dependecy should read
dependencies:
- claronot
dependencies:
- core/claro - First commit to issue fork.
- 🇳🇴Norway eiriksm Norway
So to resolve this issue we would need a minimal reproducible theme.
I have opened a MR with adding tests for 3 core themes, and that we can load the editor when they are set as the admin theme. At least locally for me, they all work.
Could someone contribute to this issue with producing the absolute minimum of an example theme making it incompatible (like in the description)?
- 🇳🇴Norway eiriksm Norway
Setting to "needs work" because we need that test case still, and after we have that, I am sure we can resolve this once and for all 🤓️
- 🇷🇺Russia gease Praha
@eiriksm Please read my comments.
Theme is incompatible, if it does not render node form through node_edit_form theme hook. - 🇳🇴Norway eiriksm Norway
Your comments are a great resource towards fixing it, thanks for that!
What I am looking for is an example theme we can put into the tests. Well I guess I found an example myself.
name: test theme type: theme base theme: false core_version_requirement: ^10 || ^11
This one file for a theme seems to trigger the problem
- 🇳🇴Norway eiriksm Norway
I now have passing tests (locally at least) and I believe this should fix the issue for anyone in this thread. Would be great if someone could verify this ✌️