function social_book_update_8902 in Open Social 10.3.x
Same name and namespace in other branches
- 10.0.x modules/social_features/social_book/social_book.install \social_book_update_8902()
- 10.1.x modules/social_features/social_book/social_book.install \social_book_update_8902()
- 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 228 - 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();
}