View mode enable throws an error when display suite is disabled

Created on 11 August 2022, over 2 years ago
Updated 16 March 2024, 9 months ago

Problem/Motivation

When trying to enable new view mode
Error: Call to a member function getLibrary() on null in ds_field_ui_layouts_save() (line 367 of modules/contrib/ds/includes/field_ui.inc).
is thrown.

Steps to reproduce

- Create a new view mode
- Go to Entity type manage display settings
- Try to enable new view mode without selecting any ds layout.

Proposed resolution

- Create a patch.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: outdated

Version

3.0

Component

Code

Created by

🇷🇸Serbia Vladimir Tanovic

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇿New Zealand jlscott

    I have been experiencing this problem when trying to save display settings for various entities.

    I have bootstrap and ds installed.

    The problem occurs when the display layout is set to "--None--" in the UI. This then comes through to line 367 (function ds_field_ui_layouts_save() ) as a $layout value of "_none", which throws the error when the library value is being set.

    Manually setting the value of $layout to "" at that point prevents the error and the display updates correctly. This is what the provided patch is doing.

  • 🇮🇳India nagsept3

    Tried to reproduce in several ways but issue not repeating

  • 🇨🇷Costa Rica maxmendez

    The patch #4 fixed my problem.

    Please try to use tis steps to reproduce:

    • Set a layout to default view mode of a content type and display some field.
    • Active a new mode, it will be inherit default view mode settings.
    • Go to the new view mode activated.
    • Set --None-- as layout and try to save.
  • Status changed to Postponed: needs info 12 months ago
  • 🇧🇪Belgium swentel

    The thing is, ds_field_ui_layouts_validate() also does that check, so I still have no idea why it is able to crash.

    I have a feeling some other module is in the way, but I can't tell for sure. could someone paste the list of modules to see if I can inspect code, because I can't reproduce this with a standard drupal core and DS enabled.

  • Status changed to Closed: outdated 9 months ago
  • 🇧🇪Belgium swentel

    closing for now - doesn't seem that many people have this, and I can't still reproduce.

Production build 0.71.5 2024