diff --git a/core/modules/block_content/src/BlockContentStorageSchema.php b/core/modules/block_content/src/BlockContentStorageSchema.php index e1107fd..b3a62df 100644 --- a/core/modules/block_content/src/BlockContentStorageSchema.php +++ b/core/modules/block_content/src/BlockContentStorageSchema.php @@ -2,9 +2,6 @@ namespace Drupal\block_content; -use Drupal\Core\Entity\ContentEntityBase; -use Drupal\Core\Entity\ContentEntityTypeInterface; -use Drupal\Core\Entity\EntityPublishedInterface; use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema; use Drupal\Core\Field\FieldStorageDefinitionInterface; @@ -16,12 +13,15 @@ class BlockContentStorageSchema extends SqlContentEntityStorageSchema { protected function getSharedTableFieldSchema(FieldStorageDefinitionInterface $storage_definition, $table_name, array $column_mapping) { $schema = parent::getSharedTableFieldSchema($storage_definition, $table_name, $column_mapping); + // Alter the 'status' field schema. if ($storage_definition->getName() == 'status') { if (\Drupal::database()->schema()->fieldExists('block_content_field_data', 'content_translation_status')) { + // When Content Translation module is used we want the initial value + // of the status field to come from there. $schema['fields']['status']['initial_from_field'] = 'content_translation_status'; } else { - // Set all block content as published. + // Otherwise we'll just set all block content as published. $schema['fields']['status']['initial'] = 1; } }