πŸ‡ΊπŸ‡ΈUnited States @jessehs

Taos, New Mexico
Account created on 13 October 2009, about 15 years ago
  • Software Architect at Phase2Β  …
#

Recent comments

πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

For others looking for this functionality, here's a patch to the 8.x-2.x branch that could be incorporated as a part of the module, but also serves as a demonstration on how to accomplish this as a standalone module. It allows a parent organization property to be added.

πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

This patch checks if this is a custom block, and if so, if it has a parent that is no longer the default revision, it will change the wording to "Translations or previous revisions" instead of "Live on page".

πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

This patch removes the offending style from ckeditor5.js. Looking at git blame, it's unclear why this inline style was added originally. It appears to go all the way back to when CKEditor 5 was added: 35972c91

πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

This patch adds the Claro "global-styling" library, which includes the variables.css file that sets this background color. I have not thoroughly tested to make sure this doesn't cause any regressions, but during a brief check I did not notice any major problems.

πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

jessehs β†’ created an issue.

πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

This patch is a "work in progress". It contains a few commented-out styles that may be helpful for debugging or testing out improvements.

πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

jessehs β†’ created an issue.

πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

Attached patch also fixes the query accessCheck requirements for Drupal 10. The module is completely broken in D10 otherwise.

πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico
πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

Looks like most of the issue was fixed in the 4.0.x dev branch. However, sites with existing config will still break. This patch adds an update hook to fix the issue with existing config. (After this process you will still need to export config and commit it to version control however.)

πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

It is working for me. Thanks!

πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

Adding a null safe operator here fixed the issue for me. Note I did not investigate the root/underlying cause of the issue. This simple change fixed the blocking error, however, and allowed the module to be used.

https://git.drupalcode.org/issue/entity_usage-3347068/-/commit/e41520cfc...

πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

jessehs β†’ made their first commit to this issue’s fork.

πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

Thanks for creating the branch! Works for me too.

πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

This differs from the last patch in that the preprocess logic from Claro should only be applied if the theme is not Gin. Otherwise it exits from those functions.

πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

This patch adds the preprocess logic from Claro and adds the editor_image_dialog form Id as described in my previous comment.

πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

This is happening for me from within Layout Builder, using an image upload button in a CKEditor field. This triggers a modal window with the missing upload widget button.

I foud that the missing preprocess (mentioned above in comment #4) would normally be in claro.theme: `claro_preprocess_file_managed_file()`

Adding that logic from Claro to my frontend theme fixes that particular issue, but I'm also seeing that there are other messed up parts of this modal/popup form. (Sorry to go on a tangent, but it might be related.)

I'm seeing that the issue is that gin_lb.module identifies this route (editor.image_dialog) as one to alter in the theme_suggestions_alter, but does not also alter the form (adding `#gin_lb_form`) in the matching route. See the two functions:

/**
 * Implements hook_theme_suggestions_alter().
 */
function gin_lb_theme_suggestions_alter(
  array &$suggestions,
  array $variables,
  $hook
) {
  if (gin_lb_is_valid_theme() === FALSE) {
    return;
  }
  $add_suggestions = FALSE;
  $route_name = \Drupal::routeMatch()->getRouteName();
  if (
  in_array(
    $route_name,
    [
      'layout_builder.add_block',
      'layout_builder.choose_block',
      'layout_builder.choose_inline_block',
      'layout_builder.remove_section',
      'layout_builder.remove_block',
      'layout_builder.choose_section',
      'view.media_library.widget_table',
      'view.media_library.widget',
      'media_library.ui',
      'editor.media_dialog',
      'editor.link_dialog',
      'editor.image_dialog', // This is the messed up route in question for me.
    ]
  )
function gin_lb_is_layout_builder_form_id($form_id, array $form) {
  if (gin_lb_is_valid_theme() === FALSE) {
    return FALSE;
  }
  $form_ids = [
    'layout_builder_add_block',
    'media_image_edit_form',
    'media_library_add_form_oembed',
    'media_library_add_form_upload',
    'layout_builder_add_block',
    'layout_builder_remove_block',
    'layout_builder_update_block',
    'layout_builder_block_move',
    'layout_builder_configure_section',
    'form-autocomplete',
    'editor_image_dialog', // I added this item to fix it.
  ];
  $form_id_contains = [
    'layout_builder_translate_form',
    'views_form_media_library_widget_',
  ];

In my case, this inconsistent route was "editor.image_dialog" -- adding the corresponding form id "editor_image_dialog" fixed some display issues I was having on the form.

To circle back around to the original bug, I think that perhaps the same `hook_theme_suggestions_alter` (to add the Claro templates) and `hook_form_alter` (to add `#gin_lb_form`) could be also used to load the preprocess logic from `claro_preprocess_image_widget`.

πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

There's a typo here that breaks the feature. The setting is hide_discard_revert_button where the .module file checks for hide_discard_revert_buttons (plural).

https://git.drupalcode.org/project/gin_lb/-/blob/1.0.x/gin_lb.module#L347

compare that with

https://git.drupalcode.org/project/gin_lb/-/blob/1.0.x/src/Form/Settings...

It's also missing a line here: https://git.drupalcode.org/project/gin_lb/-/blob/1.0.x/src/Form/Settings...

->set('hide_discard_revert_buttons', $form_state->getValue('hide_discard_revert_buttons'))
πŸ‡ΊπŸ‡ΈUnited States jessehs Taos, New Mexico

I encountered this error, along with the symptom that the the "Show content preview" checkbox was missing (in both the sidebar and the toolbar at the top).

The problem was that the parent theme of the frontend theme, Radix, was preprocessing the form element using HOOK_preprocess_form_element, and moving the input/checkbox into the label template. So since gin_lb overrides these two templates, that preprocess was messing up gin_lb's templates.

The solution was to patch the Radix theme to return if the #gin_lb_form element was present:

/**
 * Implements template_preprocess_form_element().
 */
function radix_preprocess_form_element(&$variables) {
  // Layout-builder related form elements should be left untouched.
  if (!empty($variables['element']['#gin_lb_form'])) {
    return;
  }

  // Render the form element inside the label for checkbox and radio.
  if (in_array($variables['element']['#type'], ['checkbox', 'radio'])) {
    $variables['label']['#children'] = $variables['children'];
    unset($variables['children']);
  }
}
Production build 0.71.5 2024