Added redirects to client screen after adding or deleting a linked client

This commit is contained in:
2021-07-20 14:48:50 +02:00
parent d151b1744e
commit 73d9d6490a
3 changed files with 27 additions and 15 deletions

View File

@ -46,7 +46,7 @@ use Drupal\Core\Entity\EntityTypeInterface;
* },
* links = {
* "canonical" = "/opencase/oc_organisation_relation/{oc_organisation_relation}",
* "add-page" = "/opencase//oc_organisation_relation/add",
* "add-page" = "/opencase/oc_organisation_relation/add",
* "add-form" = "/opencase/oc_organisation_relation/add/{oc_organisation_relation_type}",
* "edit-form" = "/opencase/oc_organisation_relation/{oc_organisation_relation}/edit",
* "delete-form" = "/opencase/oc_organisation_relation/{oc_organisation_relation}/delete",
@ -110,12 +110,6 @@ class OCOrganisationRelation extends ContentEntityBase implements OCOrganisation
->setDefaultValue('Link between organisations')
->setRequired(TRUE);
$fields['status']->setDescription(t('A boolean indicating whether the Organisation Relation is published.'))
->setDisplayOptions('form', [
'type' => 'boolean_checkbox',
'weight' => -3,
]);
$fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Created'))
->setDescription(t('The time that the entity was created.'));
@ -125,8 +119,7 @@ class OCOrganisationRelation extends ContentEntityBase implements OCOrganisation
->setDescription(t('The time that the entity was last edited.'));
$fields['organisations'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Organisations'))
->setDescription(t('Linked organisations'))
->setLabel(t('Organisation to Link To'))
->setSetting('target_type', 'oc_organisation')
->setSetting('handler', 'default')
->setCardinality(2)
@ -144,13 +137,15 @@ class OCOrganisationRelation extends ContentEntityBase implements OCOrganisation
->setDisplayOptions('view', [
'label' => 'above',
])
->setDefaultValueCallback('opencase_entities_organisation_relation_callback')
->setDisplayConfigurable('view', TRUE)
->setDisplayConfigurable('form', TRUE)
->setDefaultValueCallback('\Drupal\opencase_entities\Entity\OCOrganisationRelation::defaultValueCallback')
->setRequired(TRUE);
return $fields;
}
function defaultValueCallback() {
return [\Drupal::request()->query->get('organisation_id')];
}
}
function opencase_entities_organisation_relation_callback() {
return [\Drupal::request()->query->get('organisation_id')];
}