Loading core/config/schema/core.data_types.schema.yml +11 −11 Original line number Diff line number Diff line Loading @@ -427,12 +427,16 @@ config_entity: requiredKey: false type: _core_config_info # This applies to all blocks that have no additional settings of their own. block.settings.*: type: block_settings constraints: FullyValidatable: ~ block_settings: type: mapping label: 'Block settings' # This is intentionally not marked as fully validatable: each `type: block.settings.SOMETHING` must do that. mapping: id: type: string Loading @@ -441,21 +445,17 @@ block_settings: type: label label: 'Description' label_display: type: string type: label label: 'Display title' provider: type: string label: 'Provider' status: type: boolean label: 'Status' info: type: label label: 'Admin info' view_mode: type: string label: 'View mode' label: 'Provider of this block plugin' constraints: NotBlank: [] ExtensionName: [] ExtensionExists: module context_mapping: requiredKey: false type: sequence label: 'Context assignments' sequence: Loading core/modules/block/block.post_update.php +18 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,9 @@ * Post update functions for Block. */ use Drupal\block\BlockInterface; use Drupal\Core\Config\Entity\ConfigEntityUpdater; /** * Implements hook_removed_post_updates(). */ Loading @@ -16,3 +19,18 @@ function block_removed_post_updates() { 'block_post_update_replace_node_type_condition' => '10.0.0', ]; } /** * Ensures that all block weights are integers. */ function block_post_update_make_weight_integer(array &$sandbox = []): void { \Drupal::classResolver(ConfigEntityUpdater::class) ->update($sandbox, 'block', function (BlockInterface $block): bool { $weight = $block->getWeight(); if (!is_int($weight)) { $block->setWeight($weight); return TRUE; } return FALSE; }); } core/modules/block/config/schema/block.schema.yml +11 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ block.block.*: type: config_entity label: 'Block' constraints: FullyValidatable: ~ mapping: id: type: machine_name Loading @@ -17,13 +19,22 @@ block.block.*: theme: type: string label: 'Theme' constraints: NotBlank: [] ExtensionName: [] ExtensionExists: theme region: type: string label: 'Region' constraints: NotBlank: [] Callback: ['\Drupal\block\Entity\Block', validateRegion] weight: type: weight label: 'Weight' provider: # @todo Deprecate this from config schema and remove it from the `config_export` definition in https://www.drupal.org/project/drupal/issues/3426278 nullable: true type: string label: 'Provider' plugin: Loading core/modules/block/migrations/d6_block.yml +8 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,14 @@ process: right: sidebar # If mapping fails, put the block in the content region. default_value: content weight: weight weight: - plugin: get source: weight - # Block weights must be integers. plugin: callback callable: intval settings: plugin: block_settings source: Loading core/modules/block/migrations/d7_block.yml +8 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,14 @@ process: sidebar_first: 'sidebar_first' # If mapping fails, put the block in the content region. default_value: content weight: weight weight: - plugin: get source: weight - # Block weights must be integers. plugin: callback callable: intval settings: plugin: block_settings source: Loading Loading
core/config/schema/core.data_types.schema.yml +11 −11 Original line number Diff line number Diff line Loading @@ -427,12 +427,16 @@ config_entity: requiredKey: false type: _core_config_info # This applies to all blocks that have no additional settings of their own. block.settings.*: type: block_settings constraints: FullyValidatable: ~ block_settings: type: mapping label: 'Block settings' # This is intentionally not marked as fully validatable: each `type: block.settings.SOMETHING` must do that. mapping: id: type: string Loading @@ -441,21 +445,17 @@ block_settings: type: label label: 'Description' label_display: type: string type: label label: 'Display title' provider: type: string label: 'Provider' status: type: boolean label: 'Status' info: type: label label: 'Admin info' view_mode: type: string label: 'View mode' label: 'Provider of this block plugin' constraints: NotBlank: [] ExtensionName: [] ExtensionExists: module context_mapping: requiredKey: false type: sequence label: 'Context assignments' sequence: Loading
core/modules/block/block.post_update.php +18 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,9 @@ * Post update functions for Block. */ use Drupal\block\BlockInterface; use Drupal\Core\Config\Entity\ConfigEntityUpdater; /** * Implements hook_removed_post_updates(). */ Loading @@ -16,3 +19,18 @@ function block_removed_post_updates() { 'block_post_update_replace_node_type_condition' => '10.0.0', ]; } /** * Ensures that all block weights are integers. */ function block_post_update_make_weight_integer(array &$sandbox = []): void { \Drupal::classResolver(ConfigEntityUpdater::class) ->update($sandbox, 'block', function (BlockInterface $block): bool { $weight = $block->getWeight(); if (!is_int($weight)) { $block->setWeight($weight); return TRUE; } return FALSE; }); }
core/modules/block/config/schema/block.schema.yml +11 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ block.block.*: type: config_entity label: 'Block' constraints: FullyValidatable: ~ mapping: id: type: machine_name Loading @@ -17,13 +19,22 @@ block.block.*: theme: type: string label: 'Theme' constraints: NotBlank: [] ExtensionName: [] ExtensionExists: theme region: type: string label: 'Region' constraints: NotBlank: [] Callback: ['\Drupal\block\Entity\Block', validateRegion] weight: type: weight label: 'Weight' provider: # @todo Deprecate this from config schema and remove it from the `config_export` definition in https://www.drupal.org/project/drupal/issues/3426278 nullable: true type: string label: 'Provider' plugin: Loading
core/modules/block/migrations/d6_block.yml +8 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,14 @@ process: right: sidebar # If mapping fails, put the block in the content region. default_value: content weight: weight weight: - plugin: get source: weight - # Block weights must be integers. plugin: callback callable: intval settings: plugin: block_settings source: Loading
core/modules/block/migrations/d7_block.yml +8 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,14 @@ process: sidebar_first: 'sidebar_first' # If mapping fails, put the block in the content region. default_value: content weight: weight weight: - plugin: get source: weight - # Block weights must be integers. plugin: callback callable: intval settings: plugin: block_settings source: Loading