Problem/Motivation

Can't install module. drush en -y mercury_editor

Error: Call to a member function setFormClass() on null in mercury_editor_entity_type_build() (line 658 of mercury_editor.module) /var/www/html/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php(121)

Steps to reproduce

1. drush en -y mercury_editor

Proposed resolution

The reason of problem that setFormClass() called on null because entity type $entity_types['block_content'] not found.
For example, here is a list of some available entity types on my Drupal installation

array(73) {
  [0] => "block"
  [1] => "comment_type"
  [2] =>"comment"
  [3] => "config_pages_type"
  [4] =>"config_pages"
  [5] => "content_moderation_state"
  [6] => "crop"
  [7] =>"crop_type"
  [8] => "editor"
  [9] => "entity_browser"
  [10] => "environment_indicator"
  [11] =>"field_storage_config"
  [12] => "field_config"
  [13] =>"file"
  [14] =>"filter_format"
  [15] =>"group_type"
  [16] =>"group_relationship"
  [17] =>"group_config_wrapper"
  [18] =>"group"
  [19] =>"group_role"
  [20] =>"group_relationship_type"
  [21] =>"image_style"
  [22] =>"imageapi_optimize_pipeline"
  [23] =>"key_config_override"
  [24] => "key"
  [25] =>"configurable_language"
  [26] =>"language_content_settings"
  [27] =>"linkit_profile"
  ...
  [60] => "user_role"
  [61] =>"user"
  [62] =>"workflow"
  [63] =>"pathauto_pattern"
  [64] =>"view"
  [65] =>"paragraphs_type"
  [66] =>"paragraph"
  [67] =>"entity_form_mode"
  [68] =>"entity_view_mode"
  [69] =>"entity_view_display"
  [70] =>"entity_form_display"
  [71] => "date_format"
  [72] =>"base_field_override"

Attaching patch to fix this issue.

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

oleksandr.s created an issue. See original summary.

oleksandr.s’s picture

oleksandr.s’s picture

Assigned: oleksandr.s » Unassigned

anna d made their first commit to this issue’s fork.

anna d’s picture

Faced with same error during module installation.

Created MR with #2 patch.

anna d’s picture

Priority: Normal » Critical

sethhill made their first commit to this issue’s fork.

  • sethhill committed d7cd4f12 on 2.2.x authored by anna d
    Issue #3471183 by oleksandr.s, anna d: Error: Call to a member function...
sethhill’s picture

sethhill’s picture

Status: Needs review » Fixed

Replicated the issue and solution. MR looks good. Thank you!

Status: Fixed » Closed (fixed)

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