File upload button missing on the front-end

Created on 20 July 2023, 11 months ago
Updated 21 August 2023, 10 months ago

Problem/Motivation

File field inputs disappear when enabling Gin Layout Builder.

This is happening (again) on a vanilla installation while editing content on the front end theme (Olivero).
By uninstalling the module the file field displays again.

Versions:
- gin 3.0.0-rc5
- gin_lb dev-1.0.x (d0376485)

Steps to reproduce

While logged in, on a vanilla Drupal:
- composer require 'drupal/gin_lb:^1.0@RC'
- drush then gin -y; drush en gin_lb -y
- drush config:set system.theme admin gin -y
- drush config:set node.settings use_admin_theme false -y
- Navigate to /node/add/article


πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia elgandoz Canberra

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @elgandoz
  • πŸ‡¦πŸ‡ΊAustralia elgandoz Canberra
  • πŸ‡¦πŸ‡ΊAustralia elgandoz Canberra
  • πŸ‡¦πŸ‡ΊAustralia elgandoz Canberra
  • πŸ‡ΊπŸ‡¦Ukraine glu2006

    It's temp solution.
    Hope this helps.
    The problem is that we check the active theme, but the function returns the opposite value.

    /**
     * Returns true if the current theme is not gin.
     *
     * @return bool
     *   <strong>return true if gin === 'false'</strong>
     */
    function gin_lb_is_valid_theme() {
      /** @var \Drupal\Core\Theme\ThemeManagerInterface $theme_manager */
      $theme_manager = \Drupal::service('theme.manager');
      $active_theme = $theme_manager->getActiveTheme();
      if ($active_theme->getName() === 'gin' || array_key_exists('gin', $active_theme->getBaseThemeExtensions())) {
        return FALSE;
      }
      return TRUE;
    }
    
  • Status changed to Needs work 11 months ago
  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

    Hi,

    I encountered the same issue.

    Even if I agree that the boolean logic and the naming around gin_lb_is_valid_theme() function is very confusing, I think the logic behind is to trigger only when not in Gin. To be triggered in Layout Builder in front.

    But the problem is that it is not specific enough and so it alters front froms too.

    I think we need to add template suggestions to have a preprocess more specific to form element when in Layout Builder.

  • Assigned to Grimreaper
  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·
  • @grimreaper opened merge request.
  • Issue was unassigned.
  • Status changed to Fixed 10 months ago
  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

    Tested with file and image widget on:
    - gin_login
    - node form using front theme instead of Gin
    - Custom form (section_library) in Layout Builder
    - block content form in Layout Builder

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024