Fix rabbit hole settings page for entity type when bundles are not available

Created on 3 May 2023, about 1 year ago

Problem/Motivation

If no bundles are available, the Rabbit Hole settings page for one entity type looks weird:
1) It's empty:

2) There is a submit button, that triggers a warning on save:

Warning: Invalid argument supplied for foreach() in Drupal\rabbit_hole\FormManglerService->bundleSettingsFormSubmit() (line 131 of modules/custom/rabbit_hole/src/FormManglerService.php).
Drupal\rabbit_hole\FormManglerService->bundleSettingsFormSubmit(Array, Object) (Line: 120)
Drupal\rabbit_hole\Form\RabbitHoleEntityTypeSettingsForm->submitForm(Array, Object)

Steps to reproduce

1) Remove all content types;
2) Enable "Rabbit Hole" for "Content" entity type and go to "Content" settings page;

Proposed resolution

Handle it. Update tests.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine Matroskeen πŸ‡ΊπŸ‡¦ Ukraine, Lutsk

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

Comments & Activities

Production build 0.69.0 2024