upgraded to drupal 9

This commit is contained in:
naomi 2021-10-23 18:18:41 +01:00
parent b6afcfe47a
commit c19b7d4be8
5 changed files with 24 additions and 4 deletions

View File

@ -41,6 +41,11 @@ use Drupal\user\UserInterface;
* data_table = "oc_case_field_data", * data_table = "oc_case_field_data",
* revision_table = "oc_case_revision", * revision_table = "oc_case_revision",
* revision_data_table = "oc_case_field_revision", * revision_data_table = "oc_case_field_revision",
* revision_metadata_keys = {
* "revision_user" = "revision_user",
* "revision_created" = "revision_created",
* "revision_log_message" = "revision_log"
* },
* translatable = TRUE, * translatable = TRUE,
* admin_permission = "administer case entities", * admin_permission = "administer case entities",
* entity_keys = { * entity_keys = {

View File

@ -44,7 +44,7 @@ class OCCaseForm extends ContentEntityForm {
$entity->setNewRevision(); $entity->setNewRevision();
// If a new revision is created, save the current user as revision author. // If a new revision is created, save the current user as revision author.
$entity->setRevisionCreationTime(REQUEST_TIME); $entity->setRevisionCreationTime( \Drupal::time()->getRequestTime());
$entity->setRevisionUserId(\Drupal::currentUser()->id()); $entity->setRevisionUserId(\Drupal::currentUser()->id());
} }
else { else {
@ -55,19 +55,19 @@ class OCCaseForm extends ContentEntityForm {
switch ($status) { switch ($status) {
case SAVED_NEW: case SAVED_NEW:
drupal_set_message($this->t('Created the %label Case.', [ \Drupal::messenger()->addMessage($this->t('Created the %label Case.', [
'%label' => $entity->label(), '%label' => $entity->label(),
])); ]));
break; break;
default: default:
drupal_set_message($this->t('Saved the %label Case.', [ \Drupal::messenger()->addMessage($this->t('Saved the %label Case.', [
'%label' => $entity->label(), '%label' => $entity->label(),
])); ]));
} }
// If you have unpublished the entity and you can't see unpublished entities, redirect to a more informative message than just "Access Denied". // If you have unpublished the entity and you can't see unpublished entities, redirect to a more informative message than just "Access Denied".
if (!$form_state->getValue('status')['value'] && !\Drupal::currentUser()->hasPermission('view unpublished case entities')) { if (!$form_state->getValue('status')['value'] && !\Drupal::currentUser()->hasPermission('view unpublished case entities')) {
drupal_set_message($this->t('The record for "%label" is now unpublished & hidden from you.', [ \Drupal::messenger()->addMessage($this->t('The record for "%label" is now unpublished & hidden from you.', [
'%label' => $entity->label(), '%label' => $entity->label(),
])); ]));
$form_state->setRedirect('<front>'); $form_state->setRedirect('<front>');

View File

@ -43,6 +43,11 @@ use Drupal\Core\Datetime\DrupalDateTime;
* data_table = "oc_activity_field_data", * data_table = "oc_activity_field_data",
* revision_table = "oc_activity_revision", * revision_table = "oc_activity_revision",
* revision_data_table = "oc_activity_field_revision", * revision_data_table = "oc_activity_field_revision",
* revision_metadata_keys = {
* "revision_user" = "revision_user",
* "revision_created" = "revision_created",
* "revision_log_message" = "revision_log"
* },
* translatable = TRUE, * translatable = TRUE,
* admin_permission = "administer activity entities", * admin_permission = "administer activity entities",
* entity_keys = { * entity_keys = {

View File

@ -41,6 +41,11 @@ use Drupal\user\UserInterface;
* data_table = "oc_actor_field_data", * data_table = "oc_actor_field_data",
* revision_table = "oc_actor_revision", * revision_table = "oc_actor_revision",
* revision_data_table = "oc_actor_field_revision", * revision_data_table = "oc_actor_field_revision",
* revision_metadata_keys = {
* "revision_user" = "revision_user",
* "revision_created" = "revision_created",
* "revision_log_message" = "revision_log"
* },
* translatable = TRUE, * translatable = TRUE,
* admin_permission = "administer actor entities", * admin_permission = "administer actor entities",
* entity_keys = { * entity_keys = {

View File

@ -42,6 +42,11 @@ use Drupal\user\UserInterface;
* data_table = "oc_organisation_field_data", * data_table = "oc_organisation_field_data",
* revision_table = "oc_organisation_revision", * revision_table = "oc_organisation_revision",
* revision_data_table = "oc_organisation_field_revision", * revision_data_table = "oc_organisation_field_revision",
* revision_metadata_keys = {
* "revision_user" = "revision_user",
* "revision_created" = "revision_created",
* "revision_log_message" = "revision_log"
* },
* translatable = TRUE, * translatable = TRUE,
* permission_granularity = "bundle", * permission_granularity = "bundle",
* admin_permission = "administer organisation entities", * admin_permission = "administer organisation entities",