Skip to content

[5.x]: Custom sources in entry indexes forget selected sites and cause errors #15406

@MoritzLost

Description

@MoritzLost

What happened?

Description

Just ran into a curious issue. When editing a custom source on the entry indexes page, clicking on the settings for an existing custom source will 'forget' which sites were selected:

Screenshot 2024-07-24 at 17 56 41

The custom source is active for Site 1, but the checkbox is missing after opening and closing the settings modal.

Saving the modal with no sites selected for the custom will redirect and then throw an error, preventing you from changing this setting again:

array_map(): Argument #2 ($array) must be of type array, false given

Screenshot 2024-07-24 at 17 59 00

I had to hack a workaround into ElementSources::getSources() to be able to load the page again and fix the setting. Re-opening the custom source settings wipes the selected sites again.

Steps to reproduce

  1. Create a second site in the settings.
  2. In the entry index, create a custom source that is active in only one site and save the settings.
  3. Reopen the settings for the custom source and save it again.

Expected behavior

  • The custom source should not forget which sites are selected.
  • Having no sites selected should not result in an unrecoverable error.

Actual behavior

See above.

Craft CMS version

5.2.8

PHP version

8.3

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions