Problem/Motivation

When reinstalling a site with conditional_message from configuration the following error occurs in EntityTypeManager.php on line 150:

The "node_type" entity type does not exist.

ConditionalMessage::baseFieldDefinitions() uses node_type but the node dependency isn't defined so it might not be installed yet:

    // Get available content types.
    $all_types = \Drupal::entityTypeManager()
      ->getStorage('node_type')
      ->loadMultiple();
    foreach ($all_types as $machine_name => $content_type) {
      $content_types[$machine_name] = $content_type->get('name');
    }
    $fields['content_type_options'] = BaseFieldDefinition::create('list_string')
      ->setLabel(t('Content types'))
      ->setDescription(t('Select content types that will trigger the message'))
      ->setSettings([
        'allowed_values' => $content_types,
      ])
      ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)
      ->setDisplayOptions('view', [
        'label' => 'above',
        'type' => 'string',
        'weight' => -7,
      ])
      ->setDisplayOptions('form', [
        'type' => 'options_buttons',
        'weight' => -7,
      ])
      ->setDisplayConfigurable('form', TRUE)
      ->setRequired(FALSE);


Proposed resolution

We should add a dependency to drupal:node.

CommentFileSizeAuthor
#2 3065306_2.patch374 bytesmpp

Comments

mpp created an issue. See original summary.

mpp’s picture

Assigned: mpp » Unassigned
Status: Active » Needs review
StatusFileSize
new374 bytes
fernly’s picture

Status: Needs review » Reviewed & tested by the community
wranvaud’s picture

Version: 8.x-1.x-dev » 8.x-1.0-alpha5
Status: Reviewed & tested by the community » Fixed

Great! Thanks for catching this! Committed.

  • wranvaud committed 35131ff on 8.x-1.x authored by mpp
    Issue #3065306 by mpp, lennartvv: Add missing dependencies
    

Status: Fixed » Closed (fixed)

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