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.
Comments
Comment #2
mpp commentedComment #3
fernly commentedComment #4
wranvaud commentedGreat! Thanks for catching this! Committed.