function _support_ticket_comment_diff_revision_reference in Support Ticketing System 8
Determine integer comment field to write revision references into.
Parameters
\Drupal\support_ticket\SupportTicketTypeInterface $entity_type: The support ticket entity type.
string $comment_type: The comment type.
Return value
string $default The field name.
2 calls to _support_ticket_comment_diff_revision_reference()
- support_ticket_entity_update in modules/
support_ticket/ support_ticket.module - Implements hook_entity_update().
- support_ticket_form_support_ticket_type_edit_form_alter in modules/
support_ticket/ support_ticket.module - Implements hook_form_BASE_FORM_ID_alter().
File
- modules/
support_ticket/ support_ticket.module, line 823 - Enables use of support tickets with optional time tracking.
Code
function _support_ticket_comment_diff_revision_reference($entity_type, $comment_type) {
$config = \Drupal::configFactory()
->get('support_ticket.settings');
$default = $config
->get('support_ticket_type_settings.' . $entity_type . '.comment_diff_revision_reference');
if ($default === NULL) {
$fields = \Drupal::entityManager()
->getFieldDefinitions('comment', $comment_type);
foreach ($fields as $field) {
if ($field
->getType() == 'integer' && ($field_name = $field
->getName()) != 'cid') {
$default = $field_name;
\Drupal::configFactory()
->getEditable('support_ticket.settings')
->set('support_ticket_type_settings.' . $entity_type . '.comment_diff_revision_reference', $default)
->save();
break;
}
}
}
return $default;
}