You are here

function gutenberg_update_8202 in Gutenberg 8.2

Apply the Gutenberg formatter on the Reusable blocks body.

File

./gutenberg.install, line 111
Install, update and uninstall functions for the gutenberg module.

Code

function gutenberg_update_8202(&$sandbox) {
  $config_factory = \Drupal::configFactory();
  foreach ($config_factory
    ->listAll('core.entity_view_display.block_content.reusable_block.') as $name) {
    $display_mode = $config_factory
      ->getEditable($name);
    if ($display_mode
      ->get('content.body')) {
      $display_mode
        ->set('content.body.type', 'gutenberg_text');
      $display_mode
        ->set('content.body.settings', [
        'format' => 'gutenberg',
        'content_only' => TRUE,
      ]);
      $display_mode
        ->save(TRUE);
    }
  }
}