🇷🇺Russia @gease

Praha
Account created on 6 April 2010, over 14 years ago
  • Developer at Ausy 
#

Recent comments

🇷🇺Russia gease Praha

@eiriksm Please read my comments.
Theme is incompatible, if it does not render node form through node_edit_form theme hook.

🇷🇺Russia gease Praha

I made a mistake in previous comment, dependecy should read

dependencies:
- claro

not

dependencies:
- core/claro

🇷🇺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 there

function 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/claro

This is a rather dirty hack, but so far we don't have anything better.

🇷🇺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';
}
🇷🇺Russia gease Praha

I run into the similar issue. After some investigation, i found the root of the issue.
What gutenberg module does, it defines its own template for node_edit_form theme hook. But this is not core theme hook, by default node edit form does not go through it. It is defined, eg, in claro theme:

/**
 * 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';
}

And this redefinition needs in fact be present in any theme using gutenberg, otherwise either the editor would not load at all or (first line) or the essential node edit info won't be accessible (the rest).

I believe this snippet should be in the gutenberg module itself, I'll create an issue.

🇷🇺Russia gease Praha

Thanks for pointing this out @loominade, honestly, i haven't seen any distortion, but transformDimensions method should have been implemented, you're absolutely correct. It is now in release 2.0, therefore, I'm closing this ticket

🇷🇺Russia gease Praha

Sorry I'm not looking too often here. Version 2.0.0 is 10.x compatible.

Production build 0.71.5 2024