You are here

function text_post_update_add_required_summary_flag in Drupal 8

Update text_with_summary fields to add summary required flags.

File

core/modules/text/text.post_update.php, line 16
Contains post update hooks for the text module.

Code

function text_post_update_add_required_summary_flag(&$sandbox = NULL) {
  $config_entity_updater = \Drupal::classResolver(ConfigEntityUpdater::class);
  $field_callback = function (FieldConfigInterface $field) {
    if ($field
      ->getType() !== 'text_with_summary') {
      return FALSE;
    }
    $field
      ->setSetting('required_summary', FALSE);
    return TRUE;
  };
  $config_entity_updater
    ->update($sandbox, 'field_config', $field_callback);
}