Problem/Motivation

Form mode manager module allows to edit entities on different from modes.
It seems to have some issues when used with the gin theme:
- The "Show/Hide sidebar panel" functionality seems broken. The sidebar is under the form.
- Some from elements have white background when using the dark theme.

Steps to reproduce

Proposed resolution

1 Explain how to integrate the sidebar into a custom form.
2 Explain why .entity-meta__header remains white on dark gin theme.
3 Improve gin css selectors if possible
4 Move the ticket to form_mode_manager with the explanation

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Pasqualle created an issue. See original summary.

pasqualle’s picture

Title: Issues with the "Form mode manager" module » Gin theme compatibility
Project: Gin Admin Theme » Form mode manager
Version: 8.x-3.x-dev » 8.x-2.x-dev

It seems implementing hook_gin_content_form_routes() solves the problem.

Please register all the new routes with this hook.

As a quick workaround, the hook can be used in a custom module as:

function mymodule_gin_content_form_routes() {
  return [
    'entity.node.edit_form.myformmode',
  ];
}

Chester_ made their first commit to this issue’s fork.

kopeboy’s picture

Version: 8.x-2.x-dev » 3.x-dev
Status: Active » Needs review

Thank you, this works while editing entities, but how to target the /node/add/[note_type]/[form_mode] forms?

I tried

  • entity.node.[form_mode]
  • entity.node.add_form.[form_mode]
  • entity.node.add.[form_mode]

and they don't work.

EDIT: I found it by installing devel module and going to /devel/routes
=> it was node.add.[form_mode]
(weird that the pattern is different...)

kopeboy’s picture

Status: Needs review » Active
luenemann’s picture

I came up with this:

function mymodule_gin_content_form_routes(): array {
  $route_match = Drupal::routeMatch();
  if ($route_match->getRouteObject()->hasOption('_form_mode_manager_entity_type_id') && !str_starts_with($route_match->getRouteName(), 'form_mode_manager.')) {
    return [$route_match->getRouteName()];
  }
  return [];
}

tim-diels made their first commit to this issue’s fork.

tim-diels changed the visibility of the branch 3.x to hidden.

tim-diels’s picture

Status: Active » Needs review

Added the code from the latest comment as a MR as this worked for me.

tim-diels’s picture

Status: Needs review » Reviewed & tested by the community
tim-diels’s picture

Status: Reviewed & tested by the community » Needs work

Found an issue when using elasticsearch to index nodes. So will need to add an extra check.

tim-diels changed the visibility of the branch 3366187-gin-theme-compatibility to hidden.

mlncn’s picture

Status: Needs work » Needs review

Back to needs review then, this looks like. Great work, thanks!

megakeegman’s picture

Status: Needs review » Reviewed & tested by the community

Applied the issue fork and it still looks good!

niklp’s picture

I use this method elsewhere and it seems robust, haven't tested this directly yet but +1 for the approach.