Problem/Motivation

failed to add conditional fields

Steps to reproduce

I had this issue when I tried to use this module with the conditional_fields module.
I tried to add some conditional fields to the eventseries entity but failed.
The following error message appears.

The website encountered an unexpected error. Try again later.
AssertionError: Cannot load the "eventseries" entity with NULL ID. in assert() (line 261 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).

Proposed resolution

Validate the entity before loading it.
As the module use the following logic $editing = ($form_state->getBuildInfo()['form_id'] == 'eventseries_' . $entity->bundle() . '_edit_form'); to check if the form operation is editing. We could also update the EventSeriesForm file to check if the entity exists.

if ($editing && $entity->id()) {
      $original = $this->storage->loadUnchanged($entity->id());
      if ($this->step === 1) {
      ..........

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
image (4).png235.1 KBjoaopauloc.dev
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

joaopauloc.dev created an issue. See original summary.

joaopauloc.dev’s picture

Issue summary: View changes

joaopauloc.dev’s picture

Status: Active » Needs review
muriqui’s picture

Version: 2.0.x-dev » 3.0.x-dev

muriqui’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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