layout_builder.install
Same filename and directory in other branches
Contains install and update functions for Layout Builder.
File
-
core/
modules/ layout_builder/ layout_builder.install
View source
<?php
/**
* @file
* Contains install and update functions for Layout Builder.
*/
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Database\SchemaDefinition\Column;
use Drupal\Core\Database\SchemaDefinition\Index;
use Drupal\Core\Database\SchemaDefinition\PrimaryKey;
use Drupal\Core\Database\SchemaDefinition\Schema;
use Drupal\Core\Database\SchemaDefinition\SchemaDefinitionType;
use Drupal\Core\Database\SchemaDefinition\StringValue;
use Drupal\Core\Database\SchemaDefinition\Table;
/**
* Implements hook_schema().
*/
function layout_builder_schema() : Schema {
$tables[] = new Table(name: 'inline_block_usage', description: 'Track where a block_content entity is used.', columns: [
Column::int(name: 'block_content_id', description: 'The block_content entity ID.', unsigned: TRUE, notNull: TRUE),
Column::varcharAscii(name: 'layout_entity_type', description: 'The entity type of the parent entity.', length: EntityTypeInterface::ID_MAX_LENGTH, notNull: FALSE, default: new StringValue('')),
Column::varcharAscii(name: 'layout_entity_id', description: 'The ID of the parent entity.', length: 128, notNull: FALSE, default: new StringValue('0')),
], primaryKey: new PrimaryKey([
'block_content_id',
]), indexes: [
new Index(name: 'type_id', columns: [
'layout_entity_type',
'layout_entity_id',
]),
]);
return new Schema(type: SchemaDefinitionType::Module, name: 'layout_builder', tables: $tables);
}
/**
* Implements hook_update_last_removed().
*/
function layout_builder_update_last_removed() : int {
return 8602;
}
/**
* Uninstall the layout_builder_expose_all_field_blocks module.
*/
function layout_builder_update_12001() : void {
if (\Drupal::moduleHandler()->moduleExists('layout_builder_expose_all_field_blocks')) {
\Drupal::service('module_installer')->uninstall([
'layout_builder_expose_all_field_blocks',
]);
}
}
Functions
| Title | Deprecated | Summary |
|---|---|---|
| layout_builder_schema | Implements hook_schema(). | |
| layout_builder_update_12001 | Uninstall the layout_builder_expose_all_field_blocks module. | |
| layout_builder_update_last_removed | Implements hook_update_last_removed(). |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.