You are here

function social_book_update_8902 in Open Social 10.0.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_book/social_book.install \social_book_update_8902()
  2. 10.1.x modules/social_features/social_book/social_book.install \social_book_update_8902()
  3. 10.2.x modules/social_features/social_book/social_book.install \social_book_update_8902()

Update labels and settings for node book body field.

File

modules/social_features/social_book/social_book.install, line 226
Install, update and uninstall functions for the social_book module.

Code

function social_book_update_8902() {

  // Load the existing configuration.
  $config_name = 'field.field.node.book.body';
  $config = \Drupal::configFactory()
    ->getEditable($config_name);
  $config_data = $config
    ->getRawData();
  if (!empty($config_data['settings']['display_summary'])) {
    $config_data['settings']['display_summary'] = FALSE;
  }
  if (!empty($config_data['label'])) {
    $config_data['label'] = 'Description';
  }
  $config
    ->setData($config_data)
    ->save();

  // Make sure we clear cached definitions for the fields.
  \Drupal::service('entity_field.manager')
    ->clearCachedFieldDefinitions();
}