TypeError: array_search() when using Display Suite and Sticky action buttons

Created on 11 September 2024, 3 months ago

Problem/Motivation

When using Display Suite and the new beta function Enable sticky action buttons you get an error when trying to save a content type display.

TypeError: array_search(): Argument #2 ($haystack) must be of type array, null given in array_search() (line 395 of modules/contrib/ds/includes/field_ui.inc).

Steps to reproduce

Install Drupal 10 with DS en Gin.
Enable the functionality: Enable sticky action buttons in Gin settings

Go to content type, Manage display and try to save. Don't need to change anything.

🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

🇳🇱Netherlands zebda

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

Comments & Activities

  • Issue created by @zebda
  • 🇨🇭Switzerland saschaeggi Zurich

    Let's move this issue to display suite as the error comes from DS.

  • 🇧🇪Belgium swentel

    Back to gin as I need to know what this 'beta' function does. I'm searching for a key in the form structure ($form['actions']['submit']['#submit']) which doesn't seem to exist anymore? So is there an 'unset' happening or something? If that's the case, I'm not sure if that's the right approach to alter it like that, and not too keen on adding a check on gin admin theme.

  • 🇧🇪Belgium swentel

    Setting right version

  • Status changed to Postponed 3 months ago
  • 🇨🇭Switzerland saschaeggi Zurich

    Back to gin as I need to know what this 'beta' function does. I'm searching for a key in the form structure ($form['actions']['submit']['#submit']) which doesn't seem to exist anymore?

    The show form actions in sticky bar moves the form actions outside of the form into the sticky bar. We identified this as a requirement for Starshot. Currently in early stages and opt-in in 8.x-3.x.

    and not too keen on adding a check on gin admin theme.

    I'm not sure yet, but we might need to add a specific check in DS if that's a problem how it's checked in DS. Otherwise we can also define Display suite as not compatible with Gin which will mean it won't work with Starshot (Drupal CMS).

    Let's move this to postponed for after DrupalCon Barcelona.

  • Status changed to Needs review 3 months ago
  • 🇧🇪Belgium swentel

    It's a nice feature, but using unset on the form structure generally isn't a good idea. Whether it's DS, or contrib module or a custom module doing form alter doesn't really matter.

    Patch attached is a cleaner and safer option while preserving the sticky action buttons.

  • 🇮🇳India anchal_gupta

    I have test this issue in my local.
    I am able to reproduce this issue in my local with the fallowing Steps.
    Step1: Install Drupal 10.
    Step2: Install and Enable Display Suite Module.
    Step3; Install and Enable Gin Theme and set as bydefault.
    Step4: Enable sticky action buttons in Gin settings.
    Step5: And then Go to content type, Manage display and save.

    Attached Screenshot As per Reference.
    Before (Screenshot 2024-09-25 at 5.49.51 PM.png)

    Then I applying the #6 patch is working Fine not give any error.
    After - (Screenshot 2024-09-25 at 5.52.54 PM.png)

  • 🇨🇭Switzerland saschaeggi Zurich

    Is this still a problem with the latest changes from 🐛 Ensure sticky action buttons to work with modals and ajax refresh-calls Needs review applied?

  • 🇧🇪Belgium swentel

    can't test on holiday, but I fear it will, but can't tell for sure.

    Note: bonus take for my original patch is that you can can make a setting that also allows to keep the original buttons as well.

  • 🇧🇷Brazil hmendes

    @saschaeggi, I'm also using DS and Gin and found this problem when saving the forms.
    I just tested with the latest changes on the MR from 🐛 Ensure sticky action buttons to work with modals and ajax refresh-calls Needs review , I didn't test all the scenarios from that issue, so I don't wanna comment there stating that I did the tests, but for this problem with DS, it solved, thanks.

  • 🇨🇭Switzerland saschaeggi Zurich

    Let's close this in favor of 🐛 Ensure sticky action buttons to work with modals and ajax refresh-calls Needs review then 🤝

Production build 0.71.5 2024