function paragraphs_library_update_8102 in Paragraphs 8
Enable the usage warning message on edit and delete forms.
File
- modules/
paragraphs_library/ paragraphs_library.install, line 358 - Install/Update hooks for paragraphs library.
Code
function paragraphs_library_update_8102() {
$entity_usage_config = \Drupal::configFactory()
->getEditable('entity_usage.settings');
$edit_warning_enabled = $entity_usage_config
->get('edit_warning_message_entity_types') ?: [];
if (!in_array('paragraphs_library_item', $edit_warning_enabled)) {
$edit_warning_enabled[] = 'paragraphs_library_item';
$entity_usage_config
->set('edit_warning_message_entity_types', $edit_warning_enabled)
->save();
}
$delete_warning_enabled = $entity_usage_config
->get('delete_warning_message_entity_types') ?: [];
if (!in_array('paragraphs_library_item', $delete_warning_enabled)) {
$delete_warning_enabled[] = 'paragraphs_library_item';
$entity_usage_config
->set('delete_warning_message_entity_types', $delete_warning_enabled)
->save();
}
}