Put cases menu link back, and some other things

This commit is contained in:
Naomi 2020-11-15 17:39:50 +00:00
parent 7a9b95bf0d
commit 690ec3b509
8 changed files with 70 additions and 67 deletions

View File

@ -10,10 +10,3 @@ opencase_defaults.report_on_volunteers:
parent: opencase_reporting.reporting_menu
url: internal:/opencase/reporting/volunteers
weight: 1
opencase.opencase_all_cases:
title: 'Cases'
description: 'All cases I have access to'
menu_name: opencase
parent: opencase.see_all
url: internal:/opencase/all-cases
weight: -1

View File

@ -3,6 +3,18 @@
use \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchemaConverter;
function opencase_entities_update_80197() {
//check if the table exists first. If not, then create the entity.
if(!db_table_exists('oc_organisation')) {
\Drupal::entityTypeManager()->clearCachedDefinitions();
\Drupal::entityDefinitionUpdateManager()
->installEntityType(\Drupal::entityTypeManager()->getDefinition('oc_organisation'));
}
else {
return 'Organisation entity already exists';
}
}
function opencase_entities_update_80192(&$sandbox) {
$schema_converter = new SqlContentEntityStorageSchemaConverter(
'oc_actor',

View File

@ -272,7 +272,6 @@ class OCCase extends RevisionableContentEntityBase implements OCCaseInterface {
->setDisplayOptions('view', [
'label' => 'above',
])
->setDisplayConfigurable('form', true)
->setDefaultValueCallback('Drupal\opencase_entities\Entity\OCCase::defaultVal')
->setRequired(TRUE);

View File

@ -56,17 +56,17 @@ use Drupal\user\UserInterface;
* "published" = "status",
* },
* links = {
* "canonical" = "/opencase//oc_organisation/{oc_organisation}",
* "add-page" = "/opencase//oc_organisation/add",
* "add-form" = "/opencase//oc_organisation/add/{oc_organisation_type}",
* "edit-form" = "/opencase//oc_organisation/{oc_organisation}/edit",
* "delete-form" = "/opencase//oc_organisation/{oc_organisation}/delete",
* "version-history" = "/opencase//oc_organisation/{oc_organisation}/revisions",
* "revision" = "/opencase//oc_organisation/{oc_organisation}/revisions/{oc_organisation_revision}/view",
* "revision_revert" = "/opencase//oc_organisation/{oc_organisation}/revisions/{oc_organisation_revision}/revert",
* "revision_delete" = "/opencase//oc_organisation/{oc_organisation}/revisions/{oc_organisation_revision}/delete",
* "translation_revert" = "/opencase//oc_organisation/{oc_organisation}/revisions/{oc_organisation_revision}/revert/{langcode}",
* "collection" = "/opencase//oc_organisation",
* "canonical" = "/opencase/oc_organisation/{oc_organisation}",
* "add-page" = "/opencase/oc_organisation/add",
* "add-form" = "/opencase/oc_organisation/add/{oc_organisation_type}",
* "edit-form" = "/opencase/oc_organisation/{oc_organisation}/edit",
* "delete-form" = "/opencase/oc_organisation/{oc_organisation}/delete",
* "version-history" = "/opencase/oc_organisation/{oc_organisation}/revisions",
* "revision" = "/opencase/oc_organisation/{oc_organisation}/revisions/{oc_organisation_revision}/view",
* "revision_revert" = "/opencase/oc_organisation/{oc_organisation}/revisions/{oc_organisation_revision}/revert",
* "revision_delete" = "/opencase/oc_organisation/{oc_organisation}/revisions/{oc_organisation_revision}/delete",
* "translation_revert" = "/opencase/oc_organisation/{oc_organisation}/revisions/{oc_organisation_revision}/revert/{langcode}",
* "collection" = "/opencase/oc_organisation",
* },
* bundle_entity_type = "oc_organisation_type",
* field_ui_base_route = "entity.oc_organisation_type.edit_form"
@ -205,11 +205,11 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'basic_string',
'weight' => -10,
'weight' => 50,
))
->setDisplayOptions('form', array(
'type' => 'string_textarea',
'weight' => -10,
'weight' => 50,
));
$fields['contact_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Contact Name'))
@ -223,11 +223,11 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'string',
'weight' => -8,
'weight' => 51,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => -8,
'weight' => 51,
])
->setRequired(FALSE);
@ -242,11 +242,11 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -8,
'weight' => 52,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => -8,
'weight' => 52,
));
$fields['phone'] = BaseFieldDefinition::create('string')
@ -260,11 +260,11 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -7,
'weight' => 53,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => -7,
'weight' => 53,
));
$fields['postal_address'] = BaseFieldDefinition::create('string_long')
->setRevisionable(TRUE)
@ -278,11 +278,11 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'basic_string',
'weight' => -5,
'weight' => 54,
))
->setDisplayOptions('form', array(
'type' => 'string_textarea',
'weight' => -5,
'weight' => 54,
));
$fields['post_code'] = BaseFieldDefinition::create('string')
->setRevisionable(TRUE)
@ -295,11 +295,11 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -4,
'weight' => 55,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => -4,
'weight' => 55,
));
$fields['billing_contact_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Billing Contact Name'))
@ -313,11 +313,11 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'string',
'weight' => -3,
'weight' => 56,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => -3,
'weight' => 56,
])
->setRequired(FALSE);
@ -332,11 +332,11 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -2,
'weight' => 57,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => -2,
'weight' => 57,
));
$fields['billing_phone'] = BaseFieldDefinition::create('string')
@ -350,11 +350,11 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -1,
'weight' => 58,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => -1,
'weight' => 58,
));
$fields['billing_postal_address'] = BaseFieldDefinition::create('string_long')
->setRevisionable(TRUE)
@ -368,11 +368,11 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'basic_string',
'weight' => -0,
'weight' => 59,
))
->setDisplayOptions('form', array(
'type' => 'string_textarea',
'weight' => -0,
'weight' => 59,
));
$fields['billing_post_code'] = BaseFieldDefinition::create('string')
->setRevisionable(TRUE)
@ -385,36 +385,23 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => 1,
'weight' => 60,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => 1,
'weight' => 60,
));
$fields['user_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Authored by'))
->setDescription(t('The user ID of author of the Organisation entity.'))
->setLabel(t('Added by'))
->setRevisionable(TRUE)
->setSetting('target_type', 'user')
->setSetting('handler', 'default')
->setTranslatable(TRUE)
->setDisplayOptions('view', [
'label' => 'hidden',
'label' => 'inline',
'type' => 'author',
'weight' => 0,
])
->setDisplayOptions('form', [
'type' => 'entity_reference_autocomplete',
'weight' => 5,
'settings' => [
'match_operator' => 'CONTAINS',
'size' => '60',
'autocomplete_type' => 'tags',
'placeholder' => '',
],
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
'weight' => 80,
]);
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'))
@ -426,23 +413,19 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
])
->setDefaultValue('')
->setDisplayOptions('view', [
'label' => 'above',
'label' => 'hidden',
'type' => 'string',
'weight' => -4,
'weight' => -100,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => -4,
'weight' => -100,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE)
->setRequired(TRUE);
$fields['status']->setDescription(t('A boolean indicating whether the Organisation is published.'))
->setDisplayOptions('form', [
'type' => 'boolean_checkbox',
'weight' => -3,
]);
$fields['status']->setDescription(t('A boolean indicating whether the Organisation is published.'));
$fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Created'))

View File

@ -3,11 +3,22 @@ opencase.see_all:
menu_name: opencase
route_name: opencase.opencase_cases_menu
weight: 0
opencase.opencase_all_cases:
title: 'Cases'
menu_name: opencase
parent: opencase.see_all
url: internal:/opencase/all-cases
weight: -1
opencase.see_all_people_links:
class: Drupal\opencase\Plugin\Menu\SeeAllActorsMenuLink
deriver: Drupal\opencase\Plugin\Derivative\SeeAllActorsMenuLink
menu_name: opencase
parent: opencase.see_all
opencase.see_all_organisations_links:
class: Drupal\opencase\Plugin\Menu\SeeAllOrganisationsMenuLink
deriver: Drupal\opencase\Plugin\Derivative\SeeAllOrganisationsMenuLink
menu_name: opencase
parent: opencase.see_all
opencase.opencase_add_new_things_menu:
title: 'Add new...'
menu_name: opencase
@ -18,6 +29,11 @@ opencase.add_people_links:
deriver: Drupal\opencase\Plugin\Derivative\AddActorsMenuLink
menu_name: opencase
parent: opencase.opencase_add_new_things_menu
opencase.add_organisations_links:
class: Drupal\opencase\Plugin\Menu\AddOrganisationsMenuLink
deriver: Drupal\opencase\Plugin\Derivative\AddOrganisationsMenuLink
menu_name: opencase
parent: opencase.opencase_add_new_things_menu
opencase.opencase_admin_menu:
title: 'Administration'
description: 'Management and Configuration'

View File

@ -3,4 +3,4 @@ namespace Drupal\opencase\Plugin\Menu;
use Drupal\Core\Menu\MenuLinkDefault;
class SeeAllOrganisationgMenuLink extends MenuLinkDefault {}
class SeeAllOrganisationsMenuLink extends MenuLinkDefault {}