Account created on 5 November 2009, about 15 years ago
#

Recent comments

🇬🇷Greece dotoree

The problem still exists with gin 3.0.0-rc14 and mercury_editor 2.1.3, dev versions as well. I can't tell if it's Gin or ME problem.

🇬🇷Greece dotoree

@boinkster: One potential caveat is that your custom module (aka 'my_module' in example) should fire after mercury editor. This can be done with some something like Modules Weight module or with custom code.

🇬🇷Greece dotoree

The problem is that status field belongs to gin_actions group and form renders without this group, so we need to move status out of this group.

Not sure in which level should be patched, but you can override the template through a custom module to fix the problem:

a) create a new module 'my_module' and make sure that executes after mercury_editor

b) create a template in my_module/templates named 'mercury-editor-entity-form--custom.html.twig' with contents:

{#
/**
 * @file
 * Theme override for a node edit form.
 *
 * Single-column template for the node edit form.
 *
 * @see claro_form_node_form_alter()
 */
#}
{{ attach_library('mercury_editor/node_form') }}
{{ form['status_messages'] }}
<header class="me-node-form__header">
  <h1 class="me-node-form__title">{{ form['#title'] }}</h1>
</header>
{# Remove status group when in gin_actions #}
{% if form.status['#group'] == 'gin_actions' %}
  {% set status = form.status %}
  {% set status = status|merge({ '#group' : null }) %}
  {% set form = form|merge({ status: status }) %}
{% endif %}
{{ form|without('status_messages', 'advanced', 'footer', 'actions', 'gin_actions', 'gin_sidebar', 'gin_sidebar_toggle') }}
{{ form.advanced }}
{{ form.actions }}
{{ form.footer }}

c) in my_module.module:

/**
 * Implements hook_theme_suggestions_alter().
 */
function my_module_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
  switch ($hook) {
    case 'node_edit_form':
      if (in_array('mercury_editor_entity_form', $suggestions)) {
        $suggestions[] = 'mercury_editor_entity_form__custom';
      }
      break;
  }
}

/**
 * Implements hook_theme().
 */
function my_module_theme($existing, $type, $theme, $path) {
  return [
    'mercury_editor_entity_form__custom' => [
      'base hook' => 'mercury_editor_entity_form',
    ],
  ];
}
Production build 0.71.5 2024