support-2.0.x-dev/modules/support_ticket/support_ticket.install
modules/support_ticket/support_ticket.install
<?php
/**
* @file
* Install, update and uninstall functions for the support ticket module.
*/
/**
* Implements hook_install().
*/
function support_ticket_install() {
// Store default settings for support ticket diffs.
$config = \Drupal::configFactory()->getEditable('diff.settings');
$base_fields = \Drupal::service("entity_field.manager")->getBaseFieldDefinitions('support_ticket');
foreach ($base_fields as $field_key => $field) {
// If anything in the following array changes between support ticket
// revisions, a diff will be generated.
if (in_array($field_key,
[
'stid',
'support_ticket_type',
'langcode',
'title',
'uid',
'status',
'locked',
'created',
]
)) {
$compare = 1;
}
else {
$compare = 0;
}
$config->set("entity.support_ticket.$field_key", $compare);
}
$config->save();
// @todo review why the following code an errors when running the test suite:
// diff.plugins:field_types missing schema or check if it's even needed.
// $config = \Drupal::configFactory()->getEditable('diff.plugins');
// The Priority field is a list_string configured as "key => label", we need
// to compare the "label" to see human-readable changes.
// $config->set('field_types.list_string.settings.compare', 'label');
// $config->save();
}
