Compare commits
	
		
			87 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 0fe7bac594 | |||
| 8d345ce1f3 | |||
| 06b2409c61 | |||
| 99e57d9747 | |||
| 1d257538fe | |||
| 34a2d9e23b | |||
| bc98ecb541 | |||
| 0f0281c58c | |||
| c65012315d | |||
| 715f5f34c4 | |||
| 403965fe6f | |||
| eec5b876a3 | |||
| 077455b4d3 | |||
| 7a995060ce | |||
| 9646e216aa | |||
| 5afbeb956b | |||
| 2895dcdab8 | |||
| 3dd71bf2c0 | |||
| 6fbaf433e8 | |||
| 4639ff7ffd | |||
| 4285e1952f | |||
| eee7604440 | |||
| 0399c83646 | |||
| 2bc1abc7a7 | |||
| 06937b7443 | |||
| 6d281625b7 | |||
| 208240badc | |||
| c479e3b995 | |||
| 517938ab7b | |||
| b48ba012cb | |||
| 53648faff7 | |||
| a993e09bc6 | |||
| 3aa4fbc5cf | |||
| 0caf2cb7c8 | |||
| e49ad3fc9c | |||
| 146eb2b8ba | |||
| 360fe56a6d | |||
| 91cc94d3d7 | |||
| 2b9cd117ba | |||
| 36eb9d9667 | |||
| d026173c8f | |||
| 7ecdfbf3e6 | |||
| 113ff6361b | |||
| ca1a0eda29 | |||
| dfb12d9be6 | |||
| ea71314345 | |||
| 31be127d30 | |||
| 7c5ee54a44 | |||
| 21528a436e | |||
| ffb99bcac6 | |||
| a7f0e8fb02 | |||
| eb405674dc | |||
| 342459daa3 | |||
| cde0bbc7e6 | |||
| aff262a535 | |||
| 0d927126a2 | |||
| 2f485f19c5 | |||
| 8b07bbe63f | |||
| 690ec3b509 | |||
| 7a9b95bf0d | |||
| 675a85dfb6 | |||
| 17f8ddba2e | |||
| 27cb58512e | |||
| df2c826a33 | |||
| 6f33d59842 | |||
| e37a41de2b | |||
| c47df855bc | |||
| af3b4727f1 | |||
| 011029d3b3 | |||
| 9af1d58de8 | |||
| 6d93242fa9 | |||
| c9a843a35f | |||
| c46bbc6ffd | |||
| 5d1844304a | |||
| be45fd2d42 | |||
| 18a0846348 | |||
| 18e32335f5 | |||
| b83f0b44b4 | |||
| 7f88d409f0 | |||
| 8841fd4d25 | |||
| 87241c1f87 | |||
| 2a1607c6d9 | |||
| d8fd12a7b9 | |||
| e4a04a254d | |||
| 88b5ce3d2e | |||
| f47ded38fa | |||
| c63cae6b71 | 
@ -1,5 +1,5 @@
 | 
			
		||||
# OpenCase
 | 
			
		||||
A simple case-management system for small altruistic organisations.
 | 
			
		||||
A simple case-management system
 | 
			
		||||
 | 
			
		||||
## The Plan
 | 
			
		||||
OpenCase will be available as:
 | 
			
		||||
@ -28,7 +28,7 @@ If you want to install OpenCase for yourself, please get in touch via Issues. It
 | 
			
		||||
A demo site, with basic functionality is available at demo.opencase.org.uk. If you are interested, raise an issue and I will get the login to you somehow. 
 | 
			
		||||
 | 
			
		||||
## Find out more
 | 
			
		||||
* More details, including user stories for future development, can be found in the [OpenCase Gitbook](https://hoegrammer.gitbooks.io/zen-crm/content/)
 | 
			
		||||
* More details, including user stories for future development, can be found in the [OpenCase Gitbook](https://hoegrammer.gitbooks.io/opencase/content/)
 | 
			
		||||
* Raise an issue to contact the developer. 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										5
									
								
								ciac_opencase_customisations.libraries.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								ciac_opencase_customisations.libraries.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
			
		||||
ciac_grouped_views:
 | 
			
		||||
  version: 1.x
 | 
			
		||||
  css:
 | 
			
		||||
    layout:
 | 
			
		||||
      css/grouped_views.css: {}
 | 
			
		||||
@ -1,14 +1,16 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "drupal/opencase",
 | 
			
		||||
  "type": "drupal-module",
 | 
			
		||||
  "description": "Simple Case Management",
 | 
			
		||||
  "keywords": ["Drupal"],
 | 
			
		||||
  "license": "GPL-2.0+",
 | 
			
		||||
  "homepage": "https://www.drupal.org/project/opencase",
 | 
			
		||||
  "minimum-stability": "dev",
 | 
			
		||||
  "support": {
 | 
			
		||||
    "issues": "https://www.drupal.org/project/issues/opencase",
 | 
			
		||||
    "source": "http://cgit.drupalcode.org/opencase"
 | 
			
		||||
  },
 | 
			
		||||
  "require": { }
 | 
			
		||||
    "name": "autonomic/opencase",
 | 
			
		||||
    "type": "drupal-module",
 | 
			
		||||
    "authors": [
 | 
			
		||||
        {
 | 
			
		||||
            "name": "autonomic",
 | 
			
		||||
            "email": "helo@autonomic.zone"
 | 
			
		||||
        }
 | 
			
		||||
    ],
 | 
			
		||||
    "require": {
 | 
			
		||||
        "composer/installers": "*",
 | 
			
		||||
        "drupal/superfish": "*",
 | 
			
		||||
        "drupal/smtp": "*",
 | 
			
		||||
        "drupal/paragraphs_collapsible": "*"
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										852
									
								
								config/install/views.view.contact_details_changes.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										852
									
								
								config/install/views.view.contact_details_changes.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,852 @@
 | 
			
		||||
langcode: en
 | 
			
		||||
status: true
 | 
			
		||||
dependencies:
 | 
			
		||||
  module:
 | 
			
		||||
    - opencase_entities
 | 
			
		||||
    - user
 | 
			
		||||
id: contact_details_changes
 | 
			
		||||
label: 'Contact Details History'
 | 
			
		||||
module: views
 | 
			
		||||
description: ''
 | 
			
		||||
tag: ''
 | 
			
		||||
base_table: oc_actor_field_revision
 | 
			
		||||
base_field: vid
 | 
			
		||||
display:
 | 
			
		||||
  default:
 | 
			
		||||
    display_plugin: default
 | 
			
		||||
    id: default
 | 
			
		||||
    display_title: Master
 | 
			
		||||
    position: 0
 | 
			
		||||
    display_options:
 | 
			
		||||
      access:
 | 
			
		||||
        type: perm
 | 
			
		||||
        options:
 | 
			
		||||
          perm: 'view published client entities'
 | 
			
		||||
      cache:
 | 
			
		||||
        type: tag
 | 
			
		||||
        options: {  }
 | 
			
		||||
      query:
 | 
			
		||||
        type: views_query
 | 
			
		||||
        options:
 | 
			
		||||
          disable_sql_rewrite: false
 | 
			
		||||
          distinct: false
 | 
			
		||||
          replica: false
 | 
			
		||||
          query_comment: ''
 | 
			
		||||
          query_tags: {  }
 | 
			
		||||
      exposed_form:
 | 
			
		||||
        type: basic
 | 
			
		||||
        options:
 | 
			
		||||
          submit_button: Apply
 | 
			
		||||
          reset_button: false
 | 
			
		||||
          reset_button_label: Reset
 | 
			
		||||
          exposed_sorts_label: 'Sort by'
 | 
			
		||||
          expose_sort_order: true
 | 
			
		||||
          sort_asc_label: Asc
 | 
			
		||||
          sort_desc_label: Desc
 | 
			
		||||
      pager:
 | 
			
		||||
        type: none
 | 
			
		||||
        options:
 | 
			
		||||
          offset: 0
 | 
			
		||||
      style:
 | 
			
		||||
        type: table
 | 
			
		||||
        options:
 | 
			
		||||
          grouping:
 | 
			
		||||
            1:
 | 
			
		||||
              field: view_oc_actor
 | 
			
		||||
              rendered: true
 | 
			
		||||
              rendered_strip: false
 | 
			
		||||
          row_class: ''
 | 
			
		||||
          default_row_class: true
 | 
			
		||||
          override: true
 | 
			
		||||
          sticky: false
 | 
			
		||||
          caption: ''
 | 
			
		||||
          summary: ''
 | 
			
		||||
          description: ''
 | 
			
		||||
          columns:
 | 
			
		||||
            first_name: first_name
 | 
			
		||||
            middle_names: middle_names
 | 
			
		||||
            last_name: last_name
 | 
			
		||||
            id: id
 | 
			
		||||
            revision_created: revision_created
 | 
			
		||||
            view_oc_actor: view_oc_actor
 | 
			
		||||
          info:
 | 
			
		||||
            first_name:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            middle_names:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            last_name:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            id:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            revision_created:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            view_oc_actor:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
          default: '-1'
 | 
			
		||||
          empty_table: false
 | 
			
		||||
      row:
 | 
			
		||||
        type: fields
 | 
			
		||||
        options:
 | 
			
		||||
          inline: {  }
 | 
			
		||||
          separator: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          default_field_elements: true
 | 
			
		||||
      fields:
 | 
			
		||||
        revision_created:
 | 
			
		||||
          id: revision_created
 | 
			
		||||
          table: oc_actor_revision
 | 
			
		||||
          field: revision_created
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: min
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: Date
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: true
 | 
			
		||||
            text: '{{ revision_created | date(''d/m/Y'') }}'
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          set_precision: false
 | 
			
		||||
          precision: 0
 | 
			
		||||
          decimal: .
 | 
			
		||||
          separator: ''
 | 
			
		||||
          format_plural: 0
 | 
			
		||||
          format_plural_string: !!binary MQNAY291bnQ=
 | 
			
		||||
          prefix: ''
 | 
			
		||||
          suffix: ''
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: timestamp
 | 
			
		||||
          settings: {  }
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: revision_created
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        first_name:
 | 
			
		||||
          id: first_name
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: first_name
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'First Name'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: string
 | 
			
		||||
          settings:
 | 
			
		||||
            link_to_entity: false
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: first_name
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        middle_names:
 | 
			
		||||
          id: middle_names
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: middle_names
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Middle Names'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: string
 | 
			
		||||
          settings:
 | 
			
		||||
            link_to_entity: false
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: middle_names
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        last_name:
 | 
			
		||||
          id: last_name
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: last_name
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Last Name'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: string
 | 
			
		||||
          settings:
 | 
			
		||||
            link_to_entity: false
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: last_name
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        email:
 | 
			
		||||
          id: email
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: email
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Email Address'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: string
 | 
			
		||||
          settings:
 | 
			
		||||
            link_to_entity: false
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: email
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        phone:
 | 
			
		||||
          id: phone
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: phone
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Main Phone Number'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: string
 | 
			
		||||
          settings:
 | 
			
		||||
            link_to_entity: false
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: phone
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        phone2:
 | 
			
		||||
          id: phone2
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: phone2
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Alternative Phone Number'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: string
 | 
			
		||||
          settings:
 | 
			
		||||
            link_to_entity: false
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: phone2
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        postal_address:
 | 
			
		||||
          id: postal_address
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: postal_address
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Postal Address'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: basic_string
 | 
			
		||||
          settings: {  }
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: postal_address
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        post_code:
 | 
			
		||||
          id: post_code
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: post_code
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Post Code'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: string
 | 
			
		||||
          settings:
 | 
			
		||||
            link_to_entity: false
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: post_code
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        view_oc_actor:
 | 
			
		||||
          id: view_oc_actor
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: view_oc_actor
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: ''
 | 
			
		||||
          exclude: true
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: true
 | 
			
		||||
            text: "◀\tBack to current record"
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: false
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          text: 'See "rewrite results" (had to do it that way because contains HTML).'
 | 
			
		||||
          output_url_as_text: false
 | 
			
		||||
          absolute: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          plugin_id: entity_link
 | 
			
		||||
      filters: {  }
 | 
			
		||||
      sorts:
 | 
			
		||||
        revision_created:
 | 
			
		||||
          id: revision_created
 | 
			
		||||
          table: oc_actor_revision
 | 
			
		||||
          field: revision_created
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: min
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          order: DESC
 | 
			
		||||
          exposed: false
 | 
			
		||||
          expose:
 | 
			
		||||
            label: ''
 | 
			
		||||
          granularity: second
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: revision_created
 | 
			
		||||
          plugin_id: date
 | 
			
		||||
      header: {  }
 | 
			
		||||
      footer: {  }
 | 
			
		||||
      empty: {  }
 | 
			
		||||
      relationships: {  }
 | 
			
		||||
      arguments:
 | 
			
		||||
        id:
 | 
			
		||||
          id: id
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: id
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          default_action: 'not found'
 | 
			
		||||
          exception:
 | 
			
		||||
            value: all
 | 
			
		||||
            title_enable: false
 | 
			
		||||
            title: All
 | 
			
		||||
          title_enable: false
 | 
			
		||||
          title: ''
 | 
			
		||||
          default_argument_type: fixed
 | 
			
		||||
          default_argument_options:
 | 
			
		||||
            argument: ''
 | 
			
		||||
          default_argument_skip_url: false
 | 
			
		||||
          summary_options:
 | 
			
		||||
            base_path: ''
 | 
			
		||||
            count: true
 | 
			
		||||
            items_per_page: 25
 | 
			
		||||
            override: false
 | 
			
		||||
          summary:
 | 
			
		||||
            sort_order: asc
 | 
			
		||||
            number_of_records: 0
 | 
			
		||||
            format: default_summary
 | 
			
		||||
          specify_validation: false
 | 
			
		||||
          validate:
 | 
			
		||||
            type: none
 | 
			
		||||
            fail: 'not found'
 | 
			
		||||
          validate_options: {  }
 | 
			
		||||
          break_phrase: false
 | 
			
		||||
          not: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: id
 | 
			
		||||
          plugin_id: numeric
 | 
			
		||||
      display_extenders: {  }
 | 
			
		||||
      group_by: true
 | 
			
		||||
      title: 'Contact Details History'
 | 
			
		||||
    cache_metadata:
 | 
			
		||||
      max-age: -1
 | 
			
		||||
      contexts:
 | 
			
		||||
        - 'languages:language_content'
 | 
			
		||||
        - 'languages:language_interface'
 | 
			
		||||
        - url
 | 
			
		||||
        - user.permissions
 | 
			
		||||
      tags: {  }
 | 
			
		||||
  page_1:
 | 
			
		||||
    display_plugin: page
 | 
			
		||||
    id: page_1
 | 
			
		||||
    display_title: Page
 | 
			
		||||
    position: 1
 | 
			
		||||
    display_options:
 | 
			
		||||
      path: opencase/oc_actor/%/contact_details_history
 | 
			
		||||
    cache_metadata:
 | 
			
		||||
      max-age: -1
 | 
			
		||||
      contexts:
 | 
			
		||||
        - 'languages:language_content'
 | 
			
		||||
        - 'languages:language_interface'
 | 
			
		||||
        - url
 | 
			
		||||
        - user.permissions
 | 
			
		||||
      tags: {  }
 | 
			
		||||
							
								
								
									
										12
									
								
								config/schema/oc_event.schema.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								config/schema/oc_event.schema.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,12 @@
 | 
			
		||||
opencase.oc_event.*:
 | 
			
		||||
  type: config_entity
 | 
			
		||||
  label: 'Event config'
 | 
			
		||||
  mapping:
 | 
			
		||||
    id:
 | 
			
		||||
      type: string
 | 
			
		||||
      label: 'ID'
 | 
			
		||||
    label:
 | 
			
		||||
      type: label
 | 
			
		||||
      label: 'Label'
 | 
			
		||||
    uuid:
 | 
			
		||||
      type: string
 | 
			
		||||
@ -2,8 +2,25 @@ body {
 | 
			
		||||
  font-size: 100% !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* remove this confusing thing from user creation page */
 | 
			
		||||
#edit-password-policy-status {
 | 
			
		||||
  display: none;
 | 
			
		||||
} 
 | 
			
		||||
 | 
			
		||||
.form-composite > .fieldset-wrapper > .description, .form-item .description {
 | 
			
		||||
    font-size: 1em !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
div[data-drupal-selector=edit-user-bulk-form] {
 | 
			
		||||
  display: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.layout-container {
 | 
			
		||||
    max-width: 95% !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Free the people from the tyranny of the useless search button */
 | 
			
		||||
#edit-submit-actor-search{
 | 
			
		||||
#edit-submit-actor-search, #edit-submit-actor-search--2{
 | 
			
		||||
  display: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -46,3 +63,42 @@ body {
 | 
			
		||||
td.views-field {
 | 
			
		||||
    vertical-align: top;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Entity displays */
 | 
			
		||||
.oc_entity .left {
 | 
			
		||||
  display: inline-block;
 | 
			
		||||
  width: 45%;
 | 
			
		||||
  padding: 1em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.oc_entity .right {
 | 
			
		||||
  display: inline-block;
 | 
			
		||||
  width: 45%;
 | 
			
		||||
  padding: 1em;
 | 
			
		||||
  float: right;
 | 
			
		||||
}
 | 
			
		||||
.oc_entity .field {
 | 
			
		||||
  margin-top: 1em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Make entity reference field labels match normal field labels */
 | 
			
		||||
.field--type-entity-reference .field__label {
 | 
			
		||||
  font-family: Georgia, "Times New Roman", Times, serif;
 | 
			
		||||
  font-size: 1em !important;
 | 
			
		||||
  font-weight: bold !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Styling for grouped views */
 | 
			
		||||
table.views-table.views-view-table caption {
 | 
			
		||||
  text-align: left;
 | 
			
		||||
  margin-bottom: 1em;
 | 
			
		||||
  margin-top: 2em;
 | 
			
		||||
  font-weight: bold;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* remove "details" accordion, see https://drupal.stackexchange.com/questions/294312/why-has-this-details-accordion-appeared-in-this-view */
 | 
			
		||||
.views-table details {
 | 
			
		||||
 | 
			
		||||
    display: none;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										67
									
								
								docs/install.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								docs/install.txt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,67 @@
 | 
			
		||||
 | 
			
		||||
composer create-project drupal/recommended-project:8.9.8 drupal
 | 
			
		||||
 | 
			
		||||
# ADD THIS TO drupal/composer.json IN THE REPOSITORIES SECTION
 | 
			
		||||
,{
 | 
			
		||||
 | 
			
		||||
            "type": "vcs",
 | 
			
		||||
            "url": "https://git.autonomic.zone/autonomic-cooperative/opencase.git"
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# INSTALL MODULES VIA COMPOSER (this will add them to composer.json, which is better than using a premade one, because this way the versions will all sort themselves out)
 | 
			
		||||
composer require drupal/admin_toolbar drupal/security_review drupal/smtp drupal/opencase drupal/superfish
 | 
			
		||||
 | 
			
		||||
# CREATE DIRECTORIES AND SET UP FILE PERMISSIONS
 | 
			
		||||
 | 
			
		||||
# start in drupal directory
 | 
			
		||||
mkdir -p config/sync
 | 
			
		||||
mkdir private
 | 
			
		||||
 | 
			
		||||
# if web server user =/= deployment user:
 | 
			
		||||
# start in drupal directory
 | 
			
		||||
    sudo chgrp www-data config/sync
 | 
			
		||||
    cd web
 | 
			
		||||
    cp sites/default/default.settings.php sites/default/settings.php
 | 
			
		||||
    sudo chgrp www-data . -R
 | 
			
		||||
    mkdir sites/default/files
 | 
			
		||||
    sudo chmod g+w sites/default/files -R
 | 
			
		||||
    chmod g+w sites/default/settings.php
 | 
			
		||||
    sudo find -type d -exec chmod g+s {} \;
 | 
			
		||||
    sudo chmod g-w sites/default/
 | 
			
		||||
    sudo chmod g-w sites
 | 
			
		||||
    sudo chmod g-w sites ./sites/example.settings.local.php ./sites/development.services.yml ./sites/example.sites.php ./sites/default/default.services.yml ./sites/default/default.settings.php ./autoload.php 
 | 
			
		||||
    sudo chmod g-w -R modules/
 | 
			
		||||
    sudo chmod g-w -R core
 | 
			
		||||
    sudo chmod g-w profiles index.php update.php 
 | 
			
		||||
    sudo chmod g-w themes -R
 | 
			
		||||
    sudo chmod g-w web.config robots.txt 
 | 
			
		||||
    cd ../
 | 
			
		||||
    sudo chmod g-w -R web/modules
 | 
			
		||||
    sudo chgrp www-data private
 | 
			
		||||
    sudo chmod g+w,o-r,o-x private
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# INSTALL THE SITE
 | 
			
		||||
 | 
			
		||||
- Create a database 
 | 
			
		||||
- Go to the url and run the installer
 | 
			
		||||
 | 
			
		||||
# make settings file unwriteable now that it has been generated
 | 
			
		||||
sudo chmod a-w sites/default/settings.php
 | 
			
		||||
 | 
			
		||||
# ENABLE all the above modules 
 | 
			
		||||
drush en admin_toolbar security_review smtp opencase -y
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
# TODO set $trusted_host_patterns (in settings.php)
 | 
			
		||||
# TODO private files (in settings.php)
 | 
			
		||||
# TODO Set all the HTML roles to admin only - /admin/config/content/formats
 | 
			
		||||
# TODO run security review (make eveything untrusted except CRM Admin and Admin) - /admin/config/security-review
 | 
			
		||||
# TODO homepage -> /opencase/whatever-the-chosen-homepage, 403 - /user/login - /admin/config/system/site-information
 | 
			
		||||
# TODO disable blocks: tools, main navigation, footer menu - /admin/structure/block
 | 
			
		||||
# TODO logo & colours - admin/appearance/settings/bartik
 | 
			
		||||
# TODO disallow registering an account & turn off personal contact forms - /admin/config/people/accounts 
 | 
			
		||||
# TODO add linked actor field to form display and display display - top of both
 | 
			
		||||
# TODO change which contact form is the default - /admin/structure/contact
 | 
			
		||||
# TODO change "short" date formate to d/m/Y - /admin/config/regional/date-time
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
opencase_entities.oc_case_type.*:
 | 
			
		||||
opencase_cases.oc_case_type.*:
 | 
			
		||||
  type: config_entity
 | 
			
		||||
  label: 'Case type config'
 | 
			
		||||
  mapping:
 | 
			
		||||
							
								
								
									
										40
									
								
								modules/opencase_cases/oc_case.page.inc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								modules/opencase_cases/oc_case.page.inc
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,40 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file
 | 
			
		||||
 * Contains oc_case.page.inc.
 | 
			
		||||
 *
 | 
			
		||||
 * Page callback for Case entities.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Render\Element;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Prepares variables for Case templates.
 | 
			
		||||
 *
 | 
			
		||||
 * Default template: oc_case.html.twig.
 | 
			
		||||
 *
 | 
			
		||||
 * @param array $variables
 | 
			
		||||
 *   An associative array containing:
 | 
			
		||||
 *   - elements: An associative array containing the user information and any
 | 
			
		||||
 *   - attributes: HTML attributes for the containing element.
 | 
			
		||||
 */
 | 
			
		||||
function template_preprocess_oc_case(array &$variables) {
 | 
			
		||||
  // Separate the fields into two sections to be displayed in two columns.
 | 
			
		||||
  // Remove the name (title) field as this is displayed anyway.
 | 
			
		||||
  $variables['id'] = $variables['elements']['#oc_case']->get('id')[0]->get('value')->getValue();
 | 
			
		||||
  $variables['eva_fields'] = array(); // if the installation has any "EVA" (embedded view) fields this should catch them.
 | 
			
		||||
  $variables['base_fields'] = array();
 | 
			
		||||
  $variables['other_fields'] = array();
 | 
			
		||||
  foreach (Element::children($variables['elements']) as $key) {
 | 
			
		||||
    $variables['content'][$key] = $variables['elements'][$key];
 | 
			
		||||
    if (in_array($key, ['created', 'changed', 'files', 'actors_involved', 'status', 'user_id'])) {
 | 
			
		||||
      $variables['base_fields'][$key] = $variables['elements'][$key];
 | 
			
		||||
    } else if (strpos($key, "entity_view") !== false) {
 | 
			
		||||
      $variables['eva_fields'][$key] = $variables['elements'][$key];
 | 
			
		||||
    } else {
 | 
			
		||||
      $variables['other_fields'][$key] = $variables['elements'][$key];
 | 
			
		||||
      unset($variables['other_fields']['name']);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7
									
								
								modules/opencase_cases/opencase_cases.info.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								modules/opencase_cases/opencase_cases.info.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
			
		||||
name: 'Opencase Cases'
 | 
			
		||||
type: module
 | 
			
		||||
description: 'Provides case entities and a required field on activities linking them to a case.'
 | 
			
		||||
core: 8.x
 | 
			
		||||
package: 'OpenCase'
 | 
			
		||||
dependencies:
 | 
			
		||||
  - opencase_entities
 | 
			
		||||
							
								
								
									
										12
									
								
								modules/opencase_cases/opencase_cases.links.action.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								modules/opencase_cases/opencase_cases.links.action.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,12 @@
 | 
			
		||||
 | 
			
		||||
entity.oc_case.add_form:
 | 
			
		||||
  route_name: entity.oc_case.add_page
 | 
			
		||||
  title: 'Add Case'
 | 
			
		||||
  appears_on:
 | 
			
		||||
    - entity.oc_case.collection
 | 
			
		||||
entity.oc_case_type.add_form:
 | 
			
		||||
  route_name: entity.oc_case_type.add_form
 | 
			
		||||
  title: 'Add Case type'
 | 
			
		||||
  appears_on:
 | 
			
		||||
    - entity.oc_case_type.collection
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										25
									
								
								modules/opencase_cases/opencase_cases.links.menu.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								modules/opencase_cases/opencase_cases.links.menu.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,25 @@
 | 
			
		||||
opencase_cases.manage_case_types:
 | 
			
		||||
  title: 'Manage case types'
 | 
			
		||||
  description: 'Configure types of cases and their fields'
 | 
			
		||||
  menu_name: opencase
 | 
			
		||||
  parent: opencase.opencase_admin_menu 
 | 
			
		||||
  url: internal:/admin/opencase/oc_case_type
 | 
			
		||||
  weight: 2
 | 
			
		||||
# Case menu items definition
 | 
			
		||||
entity.oc_case.collection:
 | 
			
		||||
  title: 'Case list'
 | 
			
		||||
  route_name: entity.oc_case.collection
 | 
			
		||||
  description: 'List Case entities'
 | 
			
		||||
  parent: system.admin_structure
 | 
			
		||||
  weight: 100
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Case type menu items definition
 | 
			
		||||
entity.oc_case_type.collection:
 | 
			
		||||
  title: 'Case type'
 | 
			
		||||
  route_name: entity.oc_case_type.collection
 | 
			
		||||
  description: 'List Case type (bundles)'
 | 
			
		||||
  parent: system.admin_structure
 | 
			
		||||
  weight: 99
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										23
									
								
								modules/opencase_cases/opencase_cases.links.task.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								modules/opencase_cases/opencase_cases.links.task.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,23 @@
 | 
			
		||||
 | 
			
		||||
# Case routing definition
 | 
			
		||||
 | 
			
		||||
entity.oc_case.canonical:
 | 
			
		||||
  route_name: entity.oc_case.canonical
 | 
			
		||||
  base_route: entity.oc_case.canonical
 | 
			
		||||
  title: 'View'
 | 
			
		||||
 | 
			
		||||
entity.oc_case.edit_form:
 | 
			
		||||
  route_name: entity.oc_case.edit_form
 | 
			
		||||
  base_route: entity.oc_case.canonical
 | 
			
		||||
  title: 'Edit'
 | 
			
		||||
 | 
			
		||||
entity.oc_case.version_history:
 | 
			
		||||
  route_name: entity.oc_case.version_history
 | 
			
		||||
  base_route: entity.oc_case.canonical
 | 
			
		||||
  title: 'Revisions'
 | 
			
		||||
 | 
			
		||||
entity.oc_case.delete_form:
 | 
			
		||||
  route_name:  entity.oc_case.delete_form
 | 
			
		||||
  base_route:  entity.oc_case.canonical
 | 
			
		||||
  title: Delete
 | 
			
		||||
  weight: 10
 | 
			
		||||
							
								
								
									
										138
									
								
								modules/opencase_cases/opencase_cases.module
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										138
									
								
								modules/opencase_cases/opencase_cases.module
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,138 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file
 | 
			
		||||
 * Contains opencase_cases.module.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Routing\RouteMatchInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Implements hook_help().
 | 
			
		||||
 */
 | 
			
		||||
function opencase_cases_help($route_name, RouteMatchInterface $route_match) {
 | 
			
		||||
  switch ($route_name) {
 | 
			
		||||
    // Main module help for the opencase_cases module.
 | 
			
		||||
    case 'help.page.opencase_cases':
 | 
			
		||||
      $output = '';
 | 
			
		||||
      $output .= '<h3>' . t('About') . '</h3>';
 | 
			
		||||
      $output .= '<p>' . t('Provides case entities and a required field on activities linking them to a case.') . '</p>';
 | 
			
		||||
      return $output;
 | 
			
		||||
 | 
			
		||||
    default:
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Implements hook_theme().
 | 
			
		||||
 */
 | 
			
		||||
function opencase_cases_theme() {
 | 
			
		||||
  return [
 | 
			
		||||
    'opencase_cases' => [
 | 
			
		||||
      'render element' => 'children',
 | 
			
		||||
    ],
 | 
			
		||||
    'oc_case' => [
 | 
			
		||||
      'render element' => 'elements',
 | 
			
		||||
      'file' => 'oc_case.page.inc',
 | 
			
		||||
      'template' => 'oc_case',
 | 
			
		||||
    ],
 | 
			
		||||
    'oc_case_content_add_list' => [
 | 
			
		||||
      'render element' => 'content',
 | 
			
		||||
      'variables' => ['content' => NULL],
 | 
			
		||||
      'file' => 'oc_case.page.inc',
 | 
			
		||||
    ]
 | 
			
		||||
  ];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function opencase_cases_entity_base_field_info($entity_type) {
 | 
			
		||||
  $fields = array();
 | 
			
		||||
  
 | 
			
		||||
  // Add Case field to Activity 
 | 
			
		||||
  if ($entity_type->id() === 'oc_activity') {
 | 
			
		||||
    $fields['oc_case'] = \Drupal\Core\Field\BaseFieldDefinition::create('entity_reference')
 | 
			
		||||
      ->setLabel(t('Case'))
 | 
			
		||||
      ->setDescription(t('The case this activity belongs to.'))
 | 
			
		||||
      ->setSetting('target_type', 'oc_case')
 | 
			
		||||
      ->setSetting('handler', 'default')
 | 
			
		||||
      ->setTranslatable(TRUE)
 | 
			
		||||
      ->setCardinality(1)
 | 
			
		||||
      ->setDefaultValueCallback('opencase_cases_default_activity_case_value')
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => -3,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setRequired(TRUE);
 | 
			
		||||
  }
 | 
			
		||||
  return $fields;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* When creating an activity, it sets the case id from the URL.
 | 
			
		||||
/*/
 | 
			
		||||
public static function opencase_cases_default_activity_case_value() {
 | 
			
		||||
 return array(\Drupal::request()->query->get('case_id'));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 /**
 | 
			
		||||
 * Implementation of hook_form_alter()
 | 
			
		||||
 * Changes what page is redirected to after deleting things
 | 
			
		||||
 */
 | 
			
		||||
function opencase_cases_form_alter(&$form, &$form_state, $form_id) {
 | 
			
		||||
  if (preg_match('/oc_actor_.*_delete_form/', $form_id) or (preg_match('/oc_case_.*_delete_form/', $form_id)) or (preg_match('/oc_organisation_.*_delete_form/', $form_id))) {
 | 
			
		||||
    $form['actions']['submit']['#submit'][] = '_opencase_cases_redirect_to_home';
 | 
			
		||||
    $form['actions']['cancel']['#url'] = $form_state->getFormObject()->getEntity()->toUrl();
 | 
			
		||||
  }
 | 
			
		||||
  if (preg_match('/oc_activity_.*_delete_form/', $form_id)) {
 | 
			
		||||
    $form['actions']['submit']['#submit'][] = '_opencase_cases_delete_activity_redirect';
 | 
			
		||||
    $form['actions']['cancel']['#url'] = $form_state->getFormObject()->getEntity()->toUrl();
 | 
			
		||||
  }
 | 
			
		||||
} 
 | 
			
		||||
 
 | 
			
		||||
function _opencase_cases_redirect_to_home($form, &$form_state) {
 | 
			
		||||
  $form_state->setRedirect('<front>'); 
 | 
			
		||||
 
 | 
			
		||||
function _opencase_cases_delete_activity_redirect($form, &$form_state) {
 | 
			
		||||
  $case_id = $form_state->getFormObject()->getEntity()->oc_case->target_id;
 | 
			
		||||
  $form_state->setRedirect('entity.oc_case.canonical', ['oc_case' => $case_id]);
 | 
			
		||||
 
 | 
			
		||||
/**
 | 
			
		||||
 * Implements hook_theme_suggestions_HOOK().
 | 
			
		||||
 */
 | 
			
		||||
function opencase_cases_theme_suggestions_oc_case(array $variables) {
 | 
			
		||||
  $suggestions = [];
 | 
			
		||||
  $entity = $variables['elements']['#oc_case'];
 | 
			
		||||
  $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
 | 
			
		||||
 
 | 
			
		||||
  $suggestions[] = 'oc_case__' . $sanitized_view_mode;
 | 
			
		||||
  $suggestions[] = 'oc_case__' . $entity->bundle();
 | 
			
		||||
  $suggestions[] = 'oc_case__' . $entity->bundle() . '__' . $sanitized_view_mode;
 | 
			
		||||
  $suggestions[] = 'oc_case__' . $entity->id();
 | 
			
		||||
  $suggestions[] = 'oc_case__' . $entity->id() . '__' . $sanitized_view_mode;
 | 
			
		||||
  return $suggestions;
 | 
			
		||||
} 
 | 
			
		||||
 
 | 
			
		||||
function opencase_views_query_alter(Drupal\views\ViewExecutable $view, $query) {
 | 
			
		||||
  if ($view->getBaseEntityType() && $view->getBaseEntityType()->id() == 'oc_case') {
 | 
			
		||||
    $query->addTag('oc_case_access');
 | 
			
		||||
  }
 | 
			
		||||
  if ($view->getBaseEntityType() && $view->getBaseEntityType()->id() == 'oc_activity') {
 | 
			
		||||
    $query->addTag('oc_activity_access');
 | 
			
		||||
  }
 | 
			
		||||
} 
 | 
			
		||||
 
 | 
			
		||||
function opencase_query_oc_case_access_alter($query) {
 | 
			
		||||
  if (\Drupal::currentUser()->hasPermission('view published case entities')) {
 | 
			
		||||
    return;
 | 
			
		||||
  } 
 | 
			
		||||
  $linked_actor_id = CaseInvolvement::getLinkedActorId(\Drupal::currentUser());
 | 
			
		||||
  $query->addJoin('INNER', 'oc_case__actors_involved', 'access_filter', 'access_filter.entity_id = oc_case_field_data.id');
 | 
			
		||||
  $query->condition('access_filter.actors_involved_target_id', $linked_actor_id);
 | 
			
		||||
} 
 | 
			
		||||
 
 | 
			
		||||
function opencase_query_oc_activity_access_alter($query) {
 | 
			
		||||
  if (\Drupal::currentUser()->hasPermission('view published case entities')) {
 | 
			
		||||
    return;
 | 
			
		||||
  } 
 | 
			
		||||
  $linked_actor_id = CaseInvolvement::getLinkedActorId(\Drupal::currentUser());
 | 
			
		||||
  $query->addJoin('INNER', 'oc_case__actors_involved', 'access_filter', 'access_filter.entity_id = oc_activity_field_data.oc_case');
 | 
			
		||||
  $query->condition('access_filter.actors_involved_target_id', $linked_actor_id);
 | 
			
		||||
} 
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities;
 | 
			
		||||
namespace Drupal\opencase_cases;
 | 
			
		||||
 | 
			
		||||
class CaseInvolvement {
 | 
			
		||||
 | 
			
		||||
@ -1,12 +1,12 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Controller;
 | 
			
		||||
namespace Drupal\opencase_cases\Controller;
 | 
			
		||||
 | 
			
		||||
use Drupal\Component\Utility\Xss;
 | 
			
		||||
use Drupal\Core\Controller\ControllerBase;
 | 
			
		||||
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
 | 
			
		||||
use Drupal\Core\Url;
 | 
			
		||||
use Drupal\opencase_entities\Entity\OCCaseInterface;
 | 
			
		||||
use Drupal\opencase_cases\Entity\OCCaseInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class OCCaseController.
 | 
			
		||||
@ -48,7 +48,7 @@ class OCCaseController extends ControllerBase implements ContainerInjectionInter
 | 
			
		||||
  /**
 | 
			
		||||
   * Generates an overview table of older revisions of a Case .
 | 
			
		||||
   *
 | 
			
		||||
   * @param \Drupal\opencase_entities\Entity\OCCaseInterface $oc_case
 | 
			
		||||
   * @param \Drupal\opencase_cases\Entity\OCCaseInterface $oc_case
 | 
			
		||||
   *   A Case  object.
 | 
			
		||||
   *
 | 
			
		||||
   * @return array
 | 
			
		||||
@ -75,7 +75,7 @@ class OCCaseController extends ControllerBase implements ContainerInjectionInter
 | 
			
		||||
    $latest_revision = TRUE;
 | 
			
		||||
 | 
			
		||||
    foreach (array_reverse($vids) as $vid) {
 | 
			
		||||
      /** @var \Drupal\opencase_entities\OCCaseInterface $revision */
 | 
			
		||||
      /** @var \Drupal\opencase_cases\OCCaseInterface $revision */
 | 
			
		||||
      $revision = $oc_case_storage->loadRevision($vid);
 | 
			
		||||
      // Only show revisions that are affected by the language that is being
 | 
			
		||||
      // displayed.
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
namespace Drupal\opencase_cases\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\EntityStorageInterface;
 | 
			
		||||
use Drupal\Core\Field\BaseFieldDefinition;
 | 
			
		||||
@ -13,28 +13,28 @@ use Drupal\user\UserInterface;
 | 
			
		||||
/**
 | 
			
		||||
 * Defines the Case entity.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 * @ingroup opencase_cases
 | 
			
		||||
 *
 | 
			
		||||
 * @ContentEntityType(
 | 
			
		||||
 *   id = "oc_case",
 | 
			
		||||
 *   label = @Translation("Case"),
 | 
			
		||||
 *   bundle_label = @Translation("Case type"),
 | 
			
		||||
 *   handlers = {
 | 
			
		||||
 *     "storage" = "Drupal\opencase_entities\OCCaseStorage",
 | 
			
		||||
 *     "storage" = "Drupal\opencase_cases\OCCaseStorage",
 | 
			
		||||
 *     "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
 | 
			
		||||
 *     "list_builder" = "Drupal\opencase_entities\OCCaseListBuilder",
 | 
			
		||||
 *     "views_data" = "Drupal\opencase_entities\Entity\OCCaseViewsData",
 | 
			
		||||
 *     "translation" = "Drupal\opencase_entities\OCCaseTranslationHandler",
 | 
			
		||||
 *     "list_builder" = "Drupal\opencase_cases\OCCaseListBuilder",
 | 
			
		||||
 *     "views_data" = "Drupal\opencase_cases\Entity\OCCaseViewsData",
 | 
			
		||||
 *     "translation" = "Drupal\opencase_cases\OCCaseTranslationHandler",
 | 
			
		||||
 *
 | 
			
		||||
 *     "form" = {
 | 
			
		||||
 *       "default" = "Drupal\opencase_entities\Form\OCCaseForm",
 | 
			
		||||
 *       "add" = "Drupal\opencase_entities\Form\OCCaseForm",
 | 
			
		||||
 *       "edit" = "Drupal\opencase_entities\Form\OCCaseForm",
 | 
			
		||||
 *       "delete" = "Drupal\opencase_entities\Form\OCCaseDeleteForm",
 | 
			
		||||
 *       "default" = "Drupal\opencase_cases\Form\OCCaseForm",
 | 
			
		||||
 *       "add" = "Drupal\opencase_cases\Form\OCCaseForm",
 | 
			
		||||
 *       "edit" = "Drupal\opencase_cases\Form\OCCaseForm",
 | 
			
		||||
 *       "delete" = "Drupal\opencase_cases\Form\OCCaseDeleteForm",
 | 
			
		||||
 *     },
 | 
			
		||||
 *     "access" = "Drupal\opencase_entities\OCCaseAccessControlHandler",
 | 
			
		||||
 *     "access" = "Drupal\opencase_cases\OCCaseAccessControlHandler",
 | 
			
		||||
 *     "route_provider" = {
 | 
			
		||||
 *       "html" = "Drupal\opencase_entities\OCCaseHtmlRouteProvider",
 | 
			
		||||
 *       "html" = "Drupal\opencase_cases\OCCaseHtmlRouteProvider",
 | 
			
		||||
 *     },
 | 
			
		||||
 *   },
 | 
			
		||||
 *   base_table = "oc_case",
 | 
			
		||||
@ -74,17 +74,6 @@ class OCCase extends RevisionableContentEntityBase implements OCCaseInterface {
 | 
			
		||||
 | 
			
		||||
  use EntityChangedTrait;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * When creating a case, it sets the first involved party to the actor
 | 
			
		||||
   * id from the URL, and the second to the author's linked actor 
 | 
			
		||||
   * (if it exists and is different)
 | 
			
		||||
   */
 | 
			
		||||
  public static function defaultVal() {
 | 
			
		||||
    $author_linked_actor_id = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id())->get('field_linked_opencase_actor')->target_id;
 | 
			
		||||
    $currently_viewed_actor_id = \Drupal::request()->query->get('actor_id');
 | 
			
		||||
    return array_unique([$currently_viewed_actor_id, $author_linked_actor_id]);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
@ -222,20 +211,19 @@ class OCCase extends RevisionableContentEntityBase implements OCCaseInterface {
 | 
			
		||||
      ->setDefaultValue(TRUE);
 | 
			
		||||
 | 
			
		||||
    $fields['user_id'] = BaseFieldDefinition::create('entity_reference')
 | 
			
		||||
      ->setLabel(t('Entered by'))
 | 
			
		||||
      ->setLabel(t('Created by'))
 | 
			
		||||
      ->setDescription(t('The user ID of author of the Case entity.'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSetting('target_type', 'user')
 | 
			
		||||
      ->setSetting('handler', 'default')
 | 
			
		||||
      ->setTranslatable(TRUE)
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'inline',
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'author',
 | 
			
		||||
        'weight' => -4,
 | 
			
		||||
        'weight' => 80,
 | 
			
		||||
      ]);
 | 
			
		||||
    $fields['name'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setLabel(t('Case Title'))
 | 
			
		||||
      ->setDescription(t('A short phrase summing up what this case is about.'))
 | 
			
		||||
      ->setLabel(t('Title'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSettings([
 | 
			
		||||
        'max_length' => 50,
 | 
			
		||||
@ -245,37 +233,13 @@ class OCCase extends RevisionableContentEntityBase implements OCCaseInterface {
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'hidden',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => -3,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => -3,
 | 
			
		||||
        'weight' => -100,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setRequired(TRUE);
 | 
			
		||||
 | 
			
		||||
    $fields['actors_involved'] = BaseFieldDefinition::create('entity_reference')
 | 
			
		||||
      ->setLabel(t('Involved Parties'))
 | 
			
		||||
      ->setDescription(t('People involved in this case. To add one, start typing their name.'))
 | 
			
		||||
      ->setSetting('target_type', 'oc_actor')
 | 
			
		||||
      ->setSetting('handler', 'default')
 | 
			
		||||
      ->setTranslatable(TRUE)
 | 
			
		||||
      ->setCardinality(-1)
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'entity_reference_autocomplete',
 | 
			
		||||
        'weight' => -2,
 | 
			
		||||
        'settings' => [
 | 
			
		||||
          'match_operator' => 'CONTAINS',
 | 
			
		||||
          'size' => '60',
 | 
			
		||||
          'autocomplete_type' => 'tags',
 | 
			
		||||
          'placeholder' => '',
 | 
			
		||||
        ],
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'weight' => -2
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDefaultValueCallback('Drupal\opencase_entities\Entity\OCCase::defaultVal')
 | 
			
		||||
      ->setRequired(TRUE);
 | 
			
		||||
 | 
			
		||||
    $fields['files'] = BaseFieldDefinition::create('file')
 | 
			
		||||
      ->setLabel(t('Files'))
 | 
			
		||||
@ -295,17 +259,24 @@ class OCCase extends RevisionableContentEntityBase implements OCCaseInterface {
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'weight' => -1,
 | 
			
		||||
        'settings' => ['use_description_as_link_text' => 'true']
 | 
			
		||||
      ]);
 | 
			
		||||
 | 
			
		||||
    $fields['created'] = BaseFieldDefinition::create('created')
 | 
			
		||||
      ->setLabel(t('Created'))
 | 
			
		||||
      ->setDescription(t('The time that the entity was created.'));
 | 
			
		||||
      ->setLabel(t('Created on'))
 | 
			
		||||
      ->setDescription(t('When the case was created.'))
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'weight' => 80,
 | 
			
		||||
      ]);
 | 
			
		||||
 | 
			
		||||
    $fields['changed'] = BaseFieldDefinition::create('changed')
 | 
			
		||||
      ->setLabel(t('Changed'))
 | 
			
		||||
      ->setDescription(t('The time that the entity was last edited.'));
 | 
			
		||||
      ->setLabel(t('Last updated'))
 | 
			
		||||
      ->setDescription(t('When the case was last edited.'))
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'weight' => 80,
 | 
			
		||||
      ]);
 | 
			
		||||
 | 
			
		||||
    $fields['revision_translation_affected'] = BaseFieldDefinition::create('boolean')
 | 
			
		||||
      ->setLabel(t('Revision translation affected'))
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
namespace Drupal\opencase_cases\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\ContentEntityInterface;
 | 
			
		||||
use Drupal\Core\Entity\RevisionLogInterface;
 | 
			
		||||
@ -10,7 +10,7 @@ use Drupal\user\EntityOwnerInterface;
 | 
			
		||||
/**
 | 
			
		||||
 * Provides an interface for defining Case entities.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 * @ingroup opencase_cases
 | 
			
		||||
 */
 | 
			
		||||
interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface, EntityChangedInterface, EntityOwnerInterface {
 | 
			
		||||
 | 
			
		||||
@ -30,7 +30,7 @@ interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface,
 | 
			
		||||
   * @param string $name
 | 
			
		||||
   *   The Case name.
 | 
			
		||||
   *
 | 
			
		||||
   * @return \Drupal\opencase_entities\Entity\OCCaseInterface
 | 
			
		||||
   * @return \Drupal\opencase_cases\Entity\OCCaseInterface
 | 
			
		||||
   *   The called Case entity.
 | 
			
		||||
   */
 | 
			
		||||
  public function setName($name);
 | 
			
		||||
@ -49,7 +49,7 @@ interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface,
 | 
			
		||||
   * @param int $timestamp
 | 
			
		||||
   *   The Case creation timestamp.
 | 
			
		||||
   *
 | 
			
		||||
   * @return \Drupal\opencase_entities\Entity\OCCaseInterface
 | 
			
		||||
   * @return \Drupal\opencase_cases\Entity\OCCaseInterface
 | 
			
		||||
   *   The called Case entity.
 | 
			
		||||
   */
 | 
			
		||||
  public function setCreatedTime($timestamp);
 | 
			
		||||
@ -70,7 +70,7 @@ interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface,
 | 
			
		||||
   * @param bool $published
 | 
			
		||||
   *   TRUE to set this Case to published, FALSE to set it to unpublished.
 | 
			
		||||
   *
 | 
			
		||||
   * @return \Drupal\opencase_entities\Entity\OCCaseInterface
 | 
			
		||||
   * @return \Drupal\opencase_cases\Entity\OCCaseInterface
 | 
			
		||||
   *   The called Case entity.
 | 
			
		||||
   */
 | 
			
		||||
  public function setPublished($published);
 | 
			
		||||
@ -89,7 +89,7 @@ interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface,
 | 
			
		||||
   * @param int $timestamp
 | 
			
		||||
   *   The UNIX timestamp of when this revision was created.
 | 
			
		||||
   *
 | 
			
		||||
   * @return \Drupal\opencase_entities\Entity\OCCaseInterface
 | 
			
		||||
   * @return \Drupal\opencase_cases\Entity\OCCaseInterface
 | 
			
		||||
   *   The called Case entity.
 | 
			
		||||
   */
 | 
			
		||||
  public function setRevisionCreationTime($timestamp);
 | 
			
		||||
@ -108,7 +108,7 @@ interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface,
 | 
			
		||||
   * @param int $uid
 | 
			
		||||
   *   The user ID of the revision author.
 | 
			
		||||
   *
 | 
			
		||||
   * @return \Drupal\opencase_entities\Entity\OCCaseInterface
 | 
			
		||||
   * @return \Drupal\opencase_cases\Entity\OCCaseInterface
 | 
			
		||||
   *   The called Case entity.
 | 
			
		||||
   */
 | 
			
		||||
  public function setRevisionUserId($uid);
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
namespace Drupal\opencase_cases\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
 | 
			
		||||
 | 
			
		||||
@ -11,20 +11,20 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
 | 
			
		||||
 *   id = "oc_case_type",
 | 
			
		||||
 *   label = @Translation("Case type"),
 | 
			
		||||
 *   handlers = {
 | 
			
		||||
 *     "access" = "Drupal\opencase_entities\OCCaseTypeAccessControlHandler",
 | 
			
		||||
 *     "access" = "Drupal\opencase_cases\OCCaseTypeAccessControlHandler",
 | 
			
		||||
 *     "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
 | 
			
		||||
 *     "list_builder" = "Drupal\opencase_entities\OCCaseTypeListBuilder",
 | 
			
		||||
 *     "list_builder" = "Drupal\opencase_cases\OCCaseTypeListBuilder",
 | 
			
		||||
 *     "form" = {
 | 
			
		||||
 *       "add" = "Drupal\opencase_entities\Form\OCCaseTypeForm",
 | 
			
		||||
 *       "edit" = "Drupal\opencase_entities\Form\OCCaseTypeForm",
 | 
			
		||||
 *       "delete" = "Drupal\opencase_entities\Form\OCCaseTypeDeleteForm"
 | 
			
		||||
 *       "add" = "Drupal\opencase_cases\Form\OCCaseTypeForm",
 | 
			
		||||
 *       "edit" = "Drupal\opencase_cases\Form\OCCaseTypeForm",
 | 
			
		||||
 *       "delete" = "Drupal\opencase_cases\Form\OCCaseTypeDeleteForm"
 | 
			
		||||
 *     },
 | 
			
		||||
 *     "route_provider" = {
 | 
			
		||||
 *       "html" = "Drupal\opencase_entities\OCCaseTypeHtmlRouteProvider",
 | 
			
		||||
 *       "html" = "Drupal\opencase_cases\OCCaseTypeHtmlRouteProvider",
 | 
			
		||||
 *     },
 | 
			
		||||
 *   },
 | 
			
		||||
 *   config_prefix = "oc_case_type",
 | 
			
		||||
 *   admin_permission = "administer opencase entity bundles",
 | 
			
		||||
 *   admin_permission = "administer case bundles",
 | 
			
		||||
 *   bundle_of = "oc_case",
 | 
			
		||||
 *   entity_keys = {
 | 
			
		||||
 *     "id" = "id",
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
namespace Drupal\opencase_cases\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Config\Entity\ConfigEntityInterface;
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
namespace Drupal\opencase_cases\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\views\EntityViewsData;
 | 
			
		||||
 | 
			
		||||
@ -1,13 +1,13 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
namespace Drupal\opencase_cases\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\ContentEntityDeleteForm;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provides a form for deleting Case entities.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 * @ingroup opencase_cases
 | 
			
		||||
 */
 | 
			
		||||
class OCCaseDeleteForm extends ContentEntityDeleteForm {
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
namespace Drupal\opencase_cases\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\ContentEntityForm;
 | 
			
		||||
use Drupal\Core\Form\FormStateInterface;
 | 
			
		||||
@ -8,7 +8,7 @@ use Drupal\Core\Form\FormStateInterface;
 | 
			
		||||
/**
 | 
			
		||||
 * Form controller for Case edit forms.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 * @ingroup opencase_cases
 | 
			
		||||
 */
 | 
			
		||||
class OCCaseForm extends ContentEntityForm {
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,7 @@ class OCCaseForm extends ContentEntityForm {
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function buildForm(array $form, FormStateInterface $form_state) {
 | 
			
		||||
    /* @var $entity \Drupal\opencase_entities\Entity\OCCase */
 | 
			
		||||
    /* @var $entity \Drupal\opencase_cases\Entity\OCCase */
 | 
			
		||||
    $form = parent::buildForm($form, $form_state);
 | 
			
		||||
 | 
			
		||||
    if (!$this->entity->isNew()) {
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
namespace Drupal\opencase_cases\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Database\Connection;
 | 
			
		||||
use Drupal\Core\Entity\EntityStorageInterface;
 | 
			
		||||
@ -12,7 +12,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
 | 
			
		||||
/**
 | 
			
		||||
 * Provides a form for deleting a Case revision.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 * @ingroup opencase_cases
 | 
			
		||||
 */
 | 
			
		||||
class OCCaseRevisionDeleteForm extends ConfirmFormBase {
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,7 @@ class OCCaseRevisionDeleteForm extends ConfirmFormBase {
 | 
			
		||||
  /**
 | 
			
		||||
   * The Case revision.
 | 
			
		||||
   *
 | 
			
		||||
   * @var \Drupal\opencase_entities\Entity\OCCaseInterface
 | 
			
		||||
   * @var \Drupal\opencase_cases\Entity\OCCaseInterface
 | 
			
		||||
   */
 | 
			
		||||
  protected $revision;
 | 
			
		||||
 | 
			
		||||
@ -1,19 +1,19 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
namespace Drupal\opencase_cases\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Datetime\DateFormatterInterface;
 | 
			
		||||
use Drupal\Core\Entity\EntityStorageInterface;
 | 
			
		||||
use Drupal\Core\Form\ConfirmFormBase;
 | 
			
		||||
use Drupal\Core\Form\FormStateInterface;
 | 
			
		||||
use Drupal\Core\Url;
 | 
			
		||||
use Drupal\opencase_entities\Entity\OCCaseInterface;
 | 
			
		||||
use Drupal\opencase_cases\Entity\OCCaseInterface;
 | 
			
		||||
use Symfony\Component\DependencyInjection\ContainerInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provides a form for reverting a Case revision.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 * @ingroup opencase_cases
 | 
			
		||||
 */
 | 
			
		||||
class OCCaseRevisionRevertForm extends ConfirmFormBase {
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,7 @@ class OCCaseRevisionRevertForm extends ConfirmFormBase {
 | 
			
		||||
  /**
 | 
			
		||||
   * The Case revision.
 | 
			
		||||
   *
 | 
			
		||||
   * @var \Drupal\opencase_entities\Entity\OCCaseInterface
 | 
			
		||||
   * @var \Drupal\opencase_cases\Entity\OCCaseInterface
 | 
			
		||||
   */
 | 
			
		||||
  protected $revision;
 | 
			
		||||
 | 
			
		||||
@ -130,12 +130,12 @@ class OCCaseRevisionRevertForm extends ConfirmFormBase {
 | 
			
		||||
  /**
 | 
			
		||||
   * Prepares a revision to be reverted.
 | 
			
		||||
   *
 | 
			
		||||
   * @param \Drupal\opencase_entities\Entity\OCCaseInterface $revision
 | 
			
		||||
   * @param \Drupal\opencase_cases\Entity\OCCaseInterface $revision
 | 
			
		||||
   *   The revision to be reverted.
 | 
			
		||||
   * @param \Drupal\Core\Form\FormStateInterface $form_state
 | 
			
		||||
   *   The current state of the form.
 | 
			
		||||
   *
 | 
			
		||||
   * @return \Drupal\opencase_entities\Entity\OCCaseInterface
 | 
			
		||||
   * @return \Drupal\opencase_cases\Entity\OCCaseInterface
 | 
			
		||||
   *   The prepared revision ready to be stored.
 | 
			
		||||
   */
 | 
			
		||||
  protected function prepareRevertedRevision(OCCaseInterface $revision, FormStateInterface $form_state) {
 | 
			
		||||
@ -1,18 +1,18 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
namespace Drupal\opencase_cases\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Datetime\DateFormatterInterface;
 | 
			
		||||
use Drupal\Core\Entity\EntityStorageInterface;
 | 
			
		||||
use Drupal\Core\Form\FormStateInterface;
 | 
			
		||||
use Drupal\Core\Language\LanguageManagerInterface;
 | 
			
		||||
use Drupal\opencase_entities\Entity\OCCaseInterface;
 | 
			
		||||
use Drupal\opencase_cases\Entity\OCCaseInterface;
 | 
			
		||||
use Symfony\Component\DependencyInjection\ContainerInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provides a form for reverting a Case revision for a single translation.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 * @ingroup opencase_cases
 | 
			
		||||
 */
 | 
			
		||||
class OCCaseRevisionRevertTranslationForm extends OCCaseRevisionRevertForm {
 | 
			
		||||
 | 
			
		||||
@ -93,7 +93,7 @@ class OCCaseRevisionRevertTranslationForm extends OCCaseRevisionRevertForm {
 | 
			
		||||
  protected function prepareRevertedRevision(OCCaseInterface $revision, FormStateInterface $form_state) {
 | 
			
		||||
    $revert_untranslated_fields = $form_state->getValue('revert_untranslated_fields');
 | 
			
		||||
 | 
			
		||||
    /** @var \Drupal\opencase_entities\Entity\OCCaseInterface $default_revision */
 | 
			
		||||
    /** @var \Drupal\opencase_cases\Entity\OCCaseInterface $default_revision */
 | 
			
		||||
    $latest_revision = $this->OCCaseStorage->load($revision->id());
 | 
			
		||||
    $latest_revision_translation = $latest_revision->getTranslation($this->langcode);
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
namespace Drupal\opencase_cases\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Form\FormBase;
 | 
			
		||||
use Drupal\Core\Form\FormStateInterface;
 | 
			
		||||
@ -8,7 +8,7 @@ use Drupal\Core\Form\FormStateInterface;
 | 
			
		||||
/**
 | 
			
		||||
 * Class OCCaseSettingsForm.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 * @ingroup opencase_cases
 | 
			
		||||
 */
 | 
			
		||||
class OCCaseSettingsForm extends FormBase {
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
namespace Drupal\opencase_cases\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\EntityConfirmFormBase;
 | 
			
		||||
use Drupal\Core\Form\FormStateInterface;
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
namespace Drupal\opencase_cases\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\EntityForm;
 | 
			
		||||
use Drupal\Core\Form\FormStateInterface;
 | 
			
		||||
@ -30,7 +30,7 @@ class OCCaseTypeForm extends EntityForm {
 | 
			
		||||
      '#type' => 'machine_name',
 | 
			
		||||
      '#default_value' => $oc_case_type->id(),
 | 
			
		||||
      '#machine_name' => [
 | 
			
		||||
        'exists' => '\Drupal\opencase_entities\Entity\OCCaseType::load',
 | 
			
		||||
        'exists' => '\Drupal\opencase_cases\Entity\OCCaseType::load',
 | 
			
		||||
      ],
 | 
			
		||||
      '#disabled' => !$oc_case_type->isNew(),
 | 
			
		||||
    ];
 | 
			
		||||
@ -1,17 +1,17 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities;
 | 
			
		||||
namespace Drupal\opencase_cases;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\EntityAccessControlHandler;
 | 
			
		||||
use Drupal\Core\Entity\EntityInterface;
 | 
			
		||||
use Drupal\Core\Session\AccountInterface;
 | 
			
		||||
use Drupal\Core\Access\AccessResult;
 | 
			
		||||
use Drupal\opencase_entities\CaseInvolvement;
 | 
			
		||||
use Drupal\opencase_cases\CaseInvolvement;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Access controller for the Case entity.
 | 
			
		||||
 *
 | 
			
		||||
 * @see \Drupal\opencase_entities\Entity\OCCase.
 | 
			
		||||
 * @see \Drupal\opencase_cases\Entity\OCCase.
 | 
			
		||||
 */
 | 
			
		||||
class OCCaseAccessControlHandler extends EntityAccessControlHandler {
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,7 @@ class OCCaseAccessControlHandler extends EntityAccessControlHandler {
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
 | 
			
		||||
    /** @var \Drupal\opencase_entities\Entity\OCCaseInterface $entity */
 | 
			
		||||
    /** @var \Drupal\opencase_cases\Entity\OCCaseInterface $entity */
 | 
			
		||||
    switch ($operation) {
 | 
			
		||||
      case 'view':
 | 
			
		||||
        if (!$entity->isPublished()) {
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities;
 | 
			
		||||
namespace Drupal\opencase_cases;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\EntityTypeInterface;
 | 
			
		||||
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
 | 
			
		||||
@ -64,7 +64,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
 | 
			
		||||
      $route
 | 
			
		||||
        ->setDefaults([
 | 
			
		||||
          '_title' => "{$entity_type->getLabel()} revisions",
 | 
			
		||||
          '_controller' => '\Drupal\opencase_entities\Controller\OCCaseController::revisionOverview',
 | 
			
		||||
          '_controller' => '\Drupal\opencase_cases\Controller\OCCaseController::revisionOverview',
 | 
			
		||||
        ])
 | 
			
		||||
        ->setRequirement('_permission', 'access case revisions')
 | 
			
		||||
        ->setOption('_admin_route', TRUE);
 | 
			
		||||
@ -87,8 +87,8 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
 | 
			
		||||
      $route = new Route($entity_type->getLinkTemplate('revision'));
 | 
			
		||||
      $route
 | 
			
		||||
        ->setDefaults([
 | 
			
		||||
          '_controller' => '\Drupal\opencase_entities\Controller\OCCaseController::revisionShow',
 | 
			
		||||
          '_title_callback' => '\Drupal\opencase_entities\Controller\OCCaseController::revisionPageTitle',
 | 
			
		||||
          '_controller' => '\Drupal\opencase_cases\Controller\OCCaseController::revisionShow',
 | 
			
		||||
          '_title_callback' => '\Drupal\opencase_cases\Controller\OCCaseController::revisionPageTitle',
 | 
			
		||||
        ])
 | 
			
		||||
        ->setRequirement('_permission', 'access case revisions')
 | 
			
		||||
        ->setOption('_admin_route', TRUE);
 | 
			
		||||
@ -111,7 +111,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
 | 
			
		||||
      $route = new Route($entity_type->getLinkTemplate('revision_revert'));
 | 
			
		||||
      $route
 | 
			
		||||
        ->setDefaults([
 | 
			
		||||
          '_form' => '\Drupal\opencase_entities\Form\OCCaseRevisionRevertForm',
 | 
			
		||||
          '_form' => '\Drupal\opencase_cases\Form\OCCaseRevisionRevertForm',
 | 
			
		||||
          '_title' => 'Revert to earlier revision',
 | 
			
		||||
        ])
 | 
			
		||||
        ->setRequirement('_permission', 'revert all case revisions')
 | 
			
		||||
@ -135,7 +135,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
 | 
			
		||||
      $route = new Route($entity_type->getLinkTemplate('revision_delete'));
 | 
			
		||||
      $route
 | 
			
		||||
        ->setDefaults([
 | 
			
		||||
          '_form' => '\Drupal\opencase_entities\Form\OCCaseRevisionDeleteForm',
 | 
			
		||||
          '_form' => '\Drupal\opencase_cases\Form\OCCaseRevisionDeleteForm',
 | 
			
		||||
          '_title' => 'Delete earlier revision',
 | 
			
		||||
        ])
 | 
			
		||||
        ->setRequirement('_permission', 'delete all case revisions')
 | 
			
		||||
@ -159,7 +159,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
 | 
			
		||||
      $route = new Route($entity_type->getLinkTemplate('translation_revert'));
 | 
			
		||||
      $route
 | 
			
		||||
        ->setDefaults([
 | 
			
		||||
          '_form' => '\Drupal\opencase_entities\Form\OCCaseRevisionRevertTranslationForm',
 | 
			
		||||
          '_form' => '\Drupal\opencase_cases\Form\OCCaseRevisionRevertTranslationForm',
 | 
			
		||||
          '_title' => 'Revert to earlier revision of a translation',
 | 
			
		||||
        ])
 | 
			
		||||
        ->setRequirement('_permission', 'revert all case revisions')
 | 
			
		||||
@ -183,7 +183,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
 | 
			
		||||
      $route = new Route("/admin/structure/{$entity_type->id()}/settings");
 | 
			
		||||
      $route
 | 
			
		||||
        ->setDefaults([
 | 
			
		||||
          '_form' => 'Drupal\opencase_entities\Form\OCCaseSettingsForm',
 | 
			
		||||
          '_form' => 'Drupal\opencase_cases\Form\OCCaseSettingsForm',
 | 
			
		||||
          '_title' => "{$entity_type->getLabel()} settings",
 | 
			
		||||
        ])
 | 
			
		||||
        ->setRequirement('_permission', $entity_type->getAdminPermission())
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities;
 | 
			
		||||
namespace Drupal\opencase_cases;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\EntityInterface;
 | 
			
		||||
use Drupal\Core\Entity\EntityListBuilder;
 | 
			
		||||
@ -9,7 +9,7 @@ use Drupal\Core\Link;
 | 
			
		||||
/**
 | 
			
		||||
 * Defines a class to build a listing of Case entities.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 * @ingroup opencase_cases
 | 
			
		||||
 */
 | 
			
		||||
class OCCaseListBuilder extends EntityListBuilder {
 | 
			
		||||
 | 
			
		||||
@ -27,7 +27,7 @@ class OCCaseListBuilder extends EntityListBuilder {
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function buildRow(EntityInterface $entity) {
 | 
			
		||||
    /* @var $entity \Drupal\opencase_entities\Entity\OCCase */
 | 
			
		||||
    /* @var $entity \Drupal\opencase_cases\Entity\OCCase */
 | 
			
		||||
    $row['id'] = $entity->id();
 | 
			
		||||
    $row['name'] = Link::createFromRoute(
 | 
			
		||||
      $entity->label(),
 | 
			
		||||
@ -1,11 +1,11 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities;
 | 
			
		||||
namespace Drupal\opencase_cases;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
 | 
			
		||||
use Drupal\Core\Session\AccountInterface;
 | 
			
		||||
use Drupal\Core\Language\LanguageInterface;
 | 
			
		||||
use Drupal\opencase_entities\Entity\OCCaseInterface;
 | 
			
		||||
use Drupal\opencase_cases\Entity\OCCaseInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Defines the storage handler class for Case entities.
 | 
			
		||||
@ -13,7 +13,7 @@ use Drupal\opencase_entities\Entity\OCCaseInterface;
 | 
			
		||||
 * This extends the base storage class, adding required special handling for
 | 
			
		||||
 * Case entities.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 * @ingroup opencase_cases
 | 
			
		||||
 */
 | 
			
		||||
class OCCaseStorage extends SqlContentEntityStorage implements OCCaseStorageInterface {
 | 
			
		||||
 | 
			
		||||
@ -1,11 +1,11 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities;
 | 
			
		||||
namespace Drupal\opencase_cases;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\ContentEntityStorageInterface;
 | 
			
		||||
use Drupal\Core\Session\AccountInterface;
 | 
			
		||||
use Drupal\Core\Language\LanguageInterface;
 | 
			
		||||
use Drupal\opencase_entities\Entity\OCCaseInterface;
 | 
			
		||||
use Drupal\opencase_cases\Entity\OCCaseInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Defines the storage handler class for Case entities.
 | 
			
		||||
@ -13,14 +13,14 @@ use Drupal\opencase_entities\Entity\OCCaseInterface;
 | 
			
		||||
 * This extends the base storage class, adding required special handling for
 | 
			
		||||
 * Case entities.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 * @ingroup opencase_cases
 | 
			
		||||
 */
 | 
			
		||||
interface OCCaseStorageInterface extends ContentEntityStorageInterface {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Gets a list of Case revision IDs for a specific Case.
 | 
			
		||||
   *
 | 
			
		||||
   * @param \Drupal\opencase_entities\Entity\OCCaseInterface $entity
 | 
			
		||||
   * @param \Drupal\opencase_cases\Entity\OCCaseInterface $entity
 | 
			
		||||
   *   The Case entity.
 | 
			
		||||
   *
 | 
			
		||||
   * @return int[]
 | 
			
		||||
@ -42,7 +42,7 @@ interface OCCaseStorageInterface extends ContentEntityStorageInterface {
 | 
			
		||||
  /**
 | 
			
		||||
   * Counts the number of revisions in the default language.
 | 
			
		||||
   *
 | 
			
		||||
   * @param \Drupal\opencase_entities\Entity\OCCaseInterface $entity
 | 
			
		||||
   * @param \Drupal\opencase_cases\Entity\OCCaseInterface $entity
 | 
			
		||||
   *   The Case entity.
 | 
			
		||||
   *
 | 
			
		||||
   * @return int
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities;
 | 
			
		||||
namespace Drupal\opencase_cases;
 | 
			
		||||
 | 
			
		||||
use Drupal\content_translation\ContentTranslationHandler;
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities;
 | 
			
		||||
namespace Drupal\opencase_cases;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\EntityAccessControlHandler;
 | 
			
		||||
use Drupal\Core\Session\AccountInterface;
 | 
			
		||||
@ -11,7 +11,7 @@ use Drupal\Core\Access\AccessResult;
 | 
			
		||||
 * Defines the access control handler for the OCCaseType Config Entity.
 | 
			
		||||
 * Always allows viewing the label of the bundle.
 | 
			
		||||
 *
 | 
			
		||||
 * @see Drupal\opencase_entities\Entity\OCCaseType
 | 
			
		||||
 * @see Drupal\opencase_cases\Entity\OCCaseType
 | 
			
		||||
 */
 | 
			
		||||
class OCCaseTypeAccessControlHandler extends EntityAccessControlHandler {
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities;
 | 
			
		||||
namespace Drupal\opencase_cases;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\EntityTypeInterface;
 | 
			
		||||
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities;
 | 
			
		||||
namespace Drupal\opencase_cases;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
 | 
			
		||||
use Drupal\Core\Entity\EntityInterface;
 | 
			
		||||
							
								
								
									
										38
									
								
								modules/opencase_cases/templates/oc_case.html.twig
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								modules/opencase_cases/templates/oc_case.html.twig
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,38 @@
 | 
			
		||||
{#
 | 
			
		||||
/**
 | 
			
		||||
 * @file oc_case.html.twig
 | 
			
		||||
 * Default theme implementation to present Case data.
 | 
			
		||||
 *
 | 
			
		||||
 * This template is used when viewing Case pages.
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 * Available variables:
 | 
			
		||||
 * - content: A list of content items. Use 'content' to print all content, or
 | 
			
		||||
 * - attributes: HTML attributes for the container element.
 | 
			
		||||
 *
 | 
			
		||||
 * @see template_preprocess_oc_case()
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup themeable
 | 
			
		||||
 */
 | 
			
		||||
#}
 | 
			
		||||
<div{{ attributes.addClass('oc_case') }}>
 | 
			
		||||
  <h2>{{ title }}</h2>
 | 
			
		||||
  <div class="oc_entity">
 | 
			
		||||
    <div class="left">
 | 
			
		||||
      {{ base_fields.actors_involved }}
 | 
			
		||||
      {{ base_fields.changed }}
 | 
			
		||||
      {{ base_fields.created }}
 | 
			
		||||
      {{ base_fields.user_id }}
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="right">
 | 
			
		||||
      {% for field in other_fields %}
 | 
			
		||||
        {{ field }}
 | 
			
		||||
      {% endfor %}
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="eva_fields">
 | 
			
		||||
      {% for field in eva_fields %}
 | 
			
		||||
        {{ field }}
 | 
			
		||||
      {% endfor %}
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
@ -0,0 +1 @@
 | 
			
		||||
<!-- Add you custom twig html here -->
 | 
			
		||||
@ -0,0 +1,728 @@
 | 
			
		||||
langcode: en
 | 
			
		||||
status: true
 | 
			
		||||
dependencies:
 | 
			
		||||
  config:
 | 
			
		||||
    - field.storage.oc_actor.field_asylum_status
 | 
			
		||||
    - field.storage.oc_actor.field_marital_
 | 
			
		||||
  module:
 | 
			
		||||
    - opencase_entities
 | 
			
		||||
    - options
 | 
			
		||||
    - user
 | 
			
		||||
id: name_and_status_changes
 | 
			
		||||
label: 'Name and Status Changes'
 | 
			
		||||
module: views
 | 
			
		||||
description: ''
 | 
			
		||||
tag: ''
 | 
			
		||||
base_table: oc_actor_field_revision
 | 
			
		||||
base_field: vid
 | 
			
		||||
display:
 | 
			
		||||
  default:
 | 
			
		||||
    display_plugin: default
 | 
			
		||||
    id: default
 | 
			
		||||
    display_title: Master
 | 
			
		||||
    position: 0
 | 
			
		||||
    display_options:
 | 
			
		||||
      access:
 | 
			
		||||
        type: perm
 | 
			
		||||
        options:
 | 
			
		||||
          perm: 'view published case entities'
 | 
			
		||||
      cache:
 | 
			
		||||
        type: tag
 | 
			
		||||
        options: {  }
 | 
			
		||||
      query:
 | 
			
		||||
        type: views_query
 | 
			
		||||
        options:
 | 
			
		||||
          disable_sql_rewrite: false
 | 
			
		||||
          distinct: false
 | 
			
		||||
          replica: false
 | 
			
		||||
          query_comment: ''
 | 
			
		||||
          query_tags: {  }
 | 
			
		||||
      exposed_form:
 | 
			
		||||
        type: basic
 | 
			
		||||
        options:
 | 
			
		||||
          submit_button: Go
 | 
			
		||||
          reset_button: false
 | 
			
		||||
          reset_button_label: Reset
 | 
			
		||||
          exposed_sorts_label: 'Sort by'
 | 
			
		||||
          expose_sort_order: false
 | 
			
		||||
          sort_asc_label: Asc
 | 
			
		||||
          sort_desc_label: Desc
 | 
			
		||||
      pager:
 | 
			
		||||
        type: none
 | 
			
		||||
        options:
 | 
			
		||||
          offset: 0
 | 
			
		||||
      style:
 | 
			
		||||
        type: table
 | 
			
		||||
        options:
 | 
			
		||||
          grouping:
 | 
			
		||||
            -
 | 
			
		||||
              field: view_oc_actor
 | 
			
		||||
              rendered: true
 | 
			
		||||
              rendered_strip: false
 | 
			
		||||
          row_class: ''
 | 
			
		||||
          default_row_class: true
 | 
			
		||||
          override: true
 | 
			
		||||
          sticky: false
 | 
			
		||||
          caption: ''
 | 
			
		||||
          summary: ''
 | 
			
		||||
          description: ''
 | 
			
		||||
          columns:
 | 
			
		||||
            first_name: first_name
 | 
			
		||||
            middle_names: middle_names
 | 
			
		||||
            last_name: last_name
 | 
			
		||||
            field_asylum_status-revision_id: field_asylum_status-revision_id
 | 
			
		||||
            field_marital_-revision_id: field_marital_-revision_id
 | 
			
		||||
            view_oc_actor: view_oc_actor
 | 
			
		||||
            revision_created: revision_created
 | 
			
		||||
          info:
 | 
			
		||||
            first_name:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            middle_names:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            last_name:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            field_asylum_status-revision_id:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            field_marital_-revision_id:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            view_oc_actor:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            revision_created:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
          default: '-1'
 | 
			
		||||
          empty_table: false
 | 
			
		||||
      row:
 | 
			
		||||
        type: fields
 | 
			
		||||
        options:
 | 
			
		||||
          inline: {  }
 | 
			
		||||
          separator: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          default_field_elements: true
 | 
			
		||||
      fields:
 | 
			
		||||
        revision_created:
 | 
			
		||||
          id: revision_created
 | 
			
		||||
          table: oc_actor_revision
 | 
			
		||||
          field: revision_created
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: min
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Date changed'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: true
 | 
			
		||||
            text: '{{ revision_created | date(''d/m/Y'') }}'
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          set_precision: false
 | 
			
		||||
          precision: 0
 | 
			
		||||
          decimal: .
 | 
			
		||||
          separator: ''
 | 
			
		||||
          format_plural: 0
 | 
			
		||||
          format_plural_string: !!binary MQNAY291bnQ=
 | 
			
		||||
          prefix: ''
 | 
			
		||||
          suffix: ''
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: timestamp
 | 
			
		||||
          settings: {  }
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: revision_created
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        first_name:
 | 
			
		||||
          id: first_name
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: first_name
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'First Name'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: string
 | 
			
		||||
          settings:
 | 
			
		||||
            link_to_entity: false
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: first_name
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        middle_names:
 | 
			
		||||
          id: middle_names
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: middle_names
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Middle Names'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: string
 | 
			
		||||
          settings:
 | 
			
		||||
            link_to_entity: false
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: middle_names
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        last_name:
 | 
			
		||||
          id: last_name
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: last_name
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Last Name'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: string
 | 
			
		||||
          settings:
 | 
			
		||||
            link_to_entity: false
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: last_name
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        field_asylum_status-revision_id:
 | 
			
		||||
          id: field_asylum_status-revision_id
 | 
			
		||||
          table: oc_actor_revision__field_asylum_status
 | 
			
		||||
          field: field_asylum_status-revision_id
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Asylum status'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: list_default
 | 
			
		||||
          settings: {  }
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        field_marital_-revision_id:
 | 
			
		||||
          id: field_marital_-revision_id
 | 
			
		||||
          table: oc_actor_revision__field_marital_
 | 
			
		||||
          field: field_marital_-revision_id
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Marital status'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: list_default
 | 
			
		||||
          settings: {  }
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        view_oc_actor:
 | 
			
		||||
          id: view_oc_actor
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: view_oc_actor
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: ''
 | 
			
		||||
          exclude: true
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: true
 | 
			
		||||
            text: 'View current record for this person ▼'
 | 
			
		||||
            make_link: true
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: false
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          text: 'See "rewrite results" (had to do it that way because contains HTML).'
 | 
			
		||||
          output_url_as_text: false
 | 
			
		||||
          absolute: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          plugin_id: entity_link
 | 
			
		||||
      filters:
 | 
			
		||||
        first_name:
 | 
			
		||||
          id: first_name
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: first_name
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          operator: starts
 | 
			
		||||
          value: ''
 | 
			
		||||
          group: 1
 | 
			
		||||
          exposed: true
 | 
			
		||||
          expose:
 | 
			
		||||
            operator_id: first_name_op
 | 
			
		||||
            label: 'First Name'
 | 
			
		||||
            description: ''
 | 
			
		||||
            use_operator: false
 | 
			
		||||
            operator: first_name_op
 | 
			
		||||
            operator_limit_selection: false
 | 
			
		||||
            operator_list: {  }
 | 
			
		||||
            identifier: first_name
 | 
			
		||||
            required: false
 | 
			
		||||
            remember: false
 | 
			
		||||
            multiple: false
 | 
			
		||||
            remember_roles:
 | 
			
		||||
              authenticated: authenticated
 | 
			
		||||
              anonymous: '0'
 | 
			
		||||
              administrator: '0'
 | 
			
		||||
              overseer: '0'
 | 
			
		||||
              caseworker: '0'
 | 
			
		||||
              volunteer_co_ord: '0'
 | 
			
		||||
              opencase_admin: '0'
 | 
			
		||||
            placeholder: ''
 | 
			
		||||
          is_grouped: false
 | 
			
		||||
          group_info:
 | 
			
		||||
            label: ''
 | 
			
		||||
            description: ''
 | 
			
		||||
            identifier: ''
 | 
			
		||||
            optional: true
 | 
			
		||||
            widget: select
 | 
			
		||||
            multiple: false
 | 
			
		||||
            remember: false
 | 
			
		||||
            default_group: All
 | 
			
		||||
            default_group_multiple: {  }
 | 
			
		||||
            group_items: {  }
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: first_name
 | 
			
		||||
          plugin_id: string
 | 
			
		||||
        last_name:
 | 
			
		||||
          id: last_name
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: last_name
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          operator: starts
 | 
			
		||||
          value: ''
 | 
			
		||||
          group: 1
 | 
			
		||||
          exposed: true
 | 
			
		||||
          expose:
 | 
			
		||||
            operator_id: last_name_op
 | 
			
		||||
            label: 'Last Name'
 | 
			
		||||
            description: ''
 | 
			
		||||
            use_operator: false
 | 
			
		||||
            operator: last_name_op
 | 
			
		||||
            operator_limit_selection: false
 | 
			
		||||
            operator_list: {  }
 | 
			
		||||
            identifier: last_name
 | 
			
		||||
            required: false
 | 
			
		||||
            remember: false
 | 
			
		||||
            multiple: false
 | 
			
		||||
            remember_roles:
 | 
			
		||||
              authenticated: authenticated
 | 
			
		||||
              anonymous: '0'
 | 
			
		||||
              administrator: '0'
 | 
			
		||||
              overseer: '0'
 | 
			
		||||
              caseworker: '0'
 | 
			
		||||
              volunteer_co_ord: '0'
 | 
			
		||||
              opencase_admin: '0'
 | 
			
		||||
            placeholder: ''
 | 
			
		||||
          is_grouped: false
 | 
			
		||||
          group_info:
 | 
			
		||||
            label: ''
 | 
			
		||||
            description: ''
 | 
			
		||||
            identifier: ''
 | 
			
		||||
            optional: true
 | 
			
		||||
            widget: select
 | 
			
		||||
            multiple: false
 | 
			
		||||
            remember: false
 | 
			
		||||
            default_group: All
 | 
			
		||||
            default_group_multiple: {  }
 | 
			
		||||
            group_items: {  }
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: last_name
 | 
			
		||||
          plugin_id: string
 | 
			
		||||
      sorts:
 | 
			
		||||
        revision_created:
 | 
			
		||||
          id: revision_created
 | 
			
		||||
          table: oc_actor_revision
 | 
			
		||||
          field: revision_created
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: min
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          order: ASC
 | 
			
		||||
          exposed: false
 | 
			
		||||
          expose:
 | 
			
		||||
            label: ''
 | 
			
		||||
          granularity: second
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: revision_created
 | 
			
		||||
          plugin_id: date
 | 
			
		||||
      header: {  }
 | 
			
		||||
      footer: {  }
 | 
			
		||||
      empty: {  }
 | 
			
		||||
      relationships: {  }
 | 
			
		||||
      arguments: {  }
 | 
			
		||||
      display_extenders: {  }
 | 
			
		||||
      group_by: true
 | 
			
		||||
      use_ajax: true
 | 
			
		||||
      title: 'Name, Asylum and Marital Status Report'
 | 
			
		||||
    cache_metadata:
 | 
			
		||||
      max-age: -1
 | 
			
		||||
      contexts:
 | 
			
		||||
        - 'languages:language_content'
 | 
			
		||||
        - 'languages:language_interface'
 | 
			
		||||
        - url
 | 
			
		||||
        - user.permissions
 | 
			
		||||
      tags:
 | 
			
		||||
        - 'config:field.storage.oc_actor.field_asylum_status'
 | 
			
		||||
        - 'config:field.storage.oc_actor.field_marital_'
 | 
			
		||||
  page_1:
 | 
			
		||||
    display_plugin: page
 | 
			
		||||
    id: page_1
 | 
			
		||||
    display_title: Page
 | 
			
		||||
    position: 1
 | 
			
		||||
    display_options:
 | 
			
		||||
      path: opencase/reporting/name_and_status_changes
 | 
			
		||||
      display_extenders:
 | 
			
		||||
        library_in_views_display_extender: {  }
 | 
			
		||||
    cache_metadata:
 | 
			
		||||
      max-age: -1
 | 
			
		||||
      contexts:
 | 
			
		||||
        - 'languages:language_content'
 | 
			
		||||
        - 'languages:language_interface'
 | 
			
		||||
        - url
 | 
			
		||||
        - user.permissions
 | 
			
		||||
      tags:
 | 
			
		||||
        - 'config:field.storage.oc_actor.field_asylum_status'
 | 
			
		||||
        - 'config:field.storage.oc_actor.field_marital_'
 | 
			
		||||
@ -6,3 +6,4 @@ package: 'OpenCase'
 | 
			
		||||
dependencies:
 | 
			
		||||
  - opencase_defaults
 | 
			
		||||
  - opencase_reporting
 | 
			
		||||
  - opencase_cases
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,7 @@
 | 
			
		||||
opencase_default_reporting.report_on_status_changes:
 | 
			
		||||
  title: 'Status Changes'
 | 
			
		||||
  description: "Report on changes to people's name, asylum or marital status"
 | 
			
		||||
  parent: opencase_reporting.reporting_menu
 | 
			
		||||
  url: internal:/opencase/reporting/name_and_status_changes
 | 
			
		||||
  weight: 2
 | 
			
		||||
 | 
			
		||||
@ -17,6 +17,7 @@ function opencase_default_reporting_uninstall() {
 | 
			
		||||
    'views.view.reporting_clients',
 | 
			
		||||
    'views.view.reporting_volunteers',
 | 
			
		||||
    'views.view.reporting_cases',
 | 
			
		||||
    'views.view.name_and_status_changes',
 | 
			
		||||
    'facets.facet.asylum_status_export',
 | 
			
		||||
    'facets.facet.disability',
 | 
			
		||||
    'facets.facet.nationalities_export',
 | 
			
		||||
 | 
			
		||||
@ -477,7 +477,7 @@ display:
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          empty: true
 | 
			
		||||
          tokenize: false
 | 
			
		||||
          content: "<p>Either there are no cases involving this person, or you do not have access to them.</p> <p>To create a case, use the sidebar menu to the right</p>"
 | 
			
		||||
          content: "<p>Either there are no cases involving this person, or you do not have access to them.</p>\n"
 | 
			
		||||
          plugin_id: text_custom
 | 
			
		||||
      relationships: {  }
 | 
			
		||||
      arguments:
 | 
			
		||||
@ -584,7 +584,7 @@ display:
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          empty: true
 | 
			
		||||
          tokenize: false
 | 
			
		||||
          content: "<h1>No cases found</h1>\n<p>You do not have access to any existing cases.</p>\n<p>To <b>add a new case</b>, first search for the person you want to create a case for, using the search bar at the top right of the screen. If they are not on the system yet, add them using the <b>Add People</b> tab.</p>\n"
 | 
			
		||||
          content: "<h1>No cases found</h1>"
 | 
			
		||||
          plugin_id: text_custom
 | 
			
		||||
    cache_metadata:
 | 
			
		||||
      max-age: -1
 | 
			
		||||
@ -0,0 +1,633 @@
 | 
			
		||||
langcode: en
 | 
			
		||||
status: true
 | 
			
		||||
dependencies:
 | 
			
		||||
  config:
 | 
			
		||||
    - field.storage.oc_actor.field_asylum_status
 | 
			
		||||
    - field.storage.oc_actor.field_marital_
 | 
			
		||||
  module:
 | 
			
		||||
    - opencase_entities
 | 
			
		||||
    - options
 | 
			
		||||
    - user
 | 
			
		||||
id: name_and_status_changes
 | 
			
		||||
label: 'Name and Status Changes'
 | 
			
		||||
module: views
 | 
			
		||||
description: ''
 | 
			
		||||
tag: ''
 | 
			
		||||
base_table: oc_actor_field_revision
 | 
			
		||||
base_field: vid
 | 
			
		||||
display:
 | 
			
		||||
  default:
 | 
			
		||||
    display_plugin: default
 | 
			
		||||
    id: default
 | 
			
		||||
    display_title: Master
 | 
			
		||||
    position: 0
 | 
			
		||||
    display_options:
 | 
			
		||||
      access:
 | 
			
		||||
        type: perm
 | 
			
		||||
        options:
 | 
			
		||||
          perm: 'view published case entities'
 | 
			
		||||
      cache:
 | 
			
		||||
        type: tag
 | 
			
		||||
        options: {  }
 | 
			
		||||
      query:
 | 
			
		||||
        type: views_query
 | 
			
		||||
        options:
 | 
			
		||||
          disable_sql_rewrite: false
 | 
			
		||||
          distinct: false
 | 
			
		||||
          replica: false
 | 
			
		||||
          query_comment: ''
 | 
			
		||||
          query_tags: {  }
 | 
			
		||||
      exposed_form:
 | 
			
		||||
        type: basic
 | 
			
		||||
        options:
 | 
			
		||||
          submit_button: Apply
 | 
			
		||||
          reset_button: false
 | 
			
		||||
          reset_button_label: Reset
 | 
			
		||||
          exposed_sorts_label: 'Sort by'
 | 
			
		||||
          expose_sort_order: true
 | 
			
		||||
          sort_asc_label: Asc
 | 
			
		||||
          sort_desc_label: Desc
 | 
			
		||||
      pager:
 | 
			
		||||
        type: none
 | 
			
		||||
        options:
 | 
			
		||||
          offset: 0
 | 
			
		||||
      style:
 | 
			
		||||
        type: table
 | 
			
		||||
        options:
 | 
			
		||||
          grouping:
 | 
			
		||||
            -
 | 
			
		||||
              field: view_oc_actor
 | 
			
		||||
              rendered: true
 | 
			
		||||
              rendered_strip: false
 | 
			
		||||
          row_class: ''
 | 
			
		||||
          default_row_class: true
 | 
			
		||||
          override: true
 | 
			
		||||
          sticky: false
 | 
			
		||||
          caption: ''
 | 
			
		||||
          summary: ''
 | 
			
		||||
          description: ''
 | 
			
		||||
          columns:
 | 
			
		||||
            first_name: first_name
 | 
			
		||||
            middle_names: middle_names
 | 
			
		||||
            last_name: last_name
 | 
			
		||||
            field_asylum_status-revision_id: field_asylum_status-revision_id
 | 
			
		||||
            field_marital_-revision_id: field_marital_-revision_id
 | 
			
		||||
            view_oc_actor: view_oc_actor
 | 
			
		||||
            revision_created: revision_created
 | 
			
		||||
          info:
 | 
			
		||||
            first_name:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            middle_names:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            last_name:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            field_asylum_status-revision_id:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            field_marital_-revision_id:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            view_oc_actor:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            revision_created:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
          default: '-1'
 | 
			
		||||
          empty_table: false
 | 
			
		||||
      row:
 | 
			
		||||
        type: fields
 | 
			
		||||
        options:
 | 
			
		||||
          inline: {  }
 | 
			
		||||
          separator: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          default_field_elements: true
 | 
			
		||||
      fields:
 | 
			
		||||
        revision_created:
 | 
			
		||||
          id: revision_created
 | 
			
		||||
          table: oc_actor_revision
 | 
			
		||||
          field: revision_created
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: min
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Date changed'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: true
 | 
			
		||||
            text: '{{ revision_created | date(''d/m/Y'') }}'
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          set_precision: false
 | 
			
		||||
          precision: 0
 | 
			
		||||
          decimal: .
 | 
			
		||||
          separator: ''
 | 
			
		||||
          format_plural: 0
 | 
			
		||||
          format_plural_string: !!binary MQNAY291bnQ=
 | 
			
		||||
          prefix: ''
 | 
			
		||||
          suffix: ''
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: timestamp
 | 
			
		||||
          settings: {  }
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: revision_created
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        first_name:
 | 
			
		||||
          id: first_name
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: first_name
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'First Name'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: string
 | 
			
		||||
          settings:
 | 
			
		||||
            link_to_entity: false
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: first_name
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        middle_names:
 | 
			
		||||
          id: middle_names
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: middle_names
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Middle Names'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: string
 | 
			
		||||
          settings:
 | 
			
		||||
            link_to_entity: false
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: middle_names
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        last_name:
 | 
			
		||||
          id: last_name
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: last_name
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Last Name'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: string
 | 
			
		||||
          settings:
 | 
			
		||||
            link_to_entity: false
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: last_name
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        field_asylum_status-revision_id:
 | 
			
		||||
          id: field_asylum_status-revision_id
 | 
			
		||||
          table: oc_actor_revision__field_asylum_status
 | 
			
		||||
          field: field_asylum_status-revision_id
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Asylum status'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: list_default
 | 
			
		||||
          settings: {  }
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        field_marital_-revision_id:
 | 
			
		||||
          id: field_marital_-revision_id
 | 
			
		||||
          table: oc_actor_revision__field_marital_
 | 
			
		||||
          field: field_marital_-revision_id
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Marital status'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: value
 | 
			
		||||
          type: list_default
 | 
			
		||||
          settings: {  }
 | 
			
		||||
          group_column: value
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        view_oc_actor:
 | 
			
		||||
          id: view_oc_actor
 | 
			
		||||
          table: oc_actor_field_revision
 | 
			
		||||
          field: view_oc_actor
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: ''
 | 
			
		||||
          exclude: true
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: true
 | 
			
		||||
            text: 'View the current record for this person ▼'
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: false
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          text: ''
 | 
			
		||||
          output_url_as_text: false
 | 
			
		||||
          absolute: false
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          plugin_id: entity_link
 | 
			
		||||
      filters: {  }
 | 
			
		||||
      sorts:
 | 
			
		||||
        revision_created:
 | 
			
		||||
          id: revision_created
 | 
			
		||||
          table: oc_actor_revision
 | 
			
		||||
          field: revision_created
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: min
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          order: DESC
 | 
			
		||||
          exposed: false
 | 
			
		||||
          expose:
 | 
			
		||||
            label: ''
 | 
			
		||||
          granularity: second
 | 
			
		||||
          entity_type: oc_actor
 | 
			
		||||
          entity_field: revision_created
 | 
			
		||||
          plugin_id: date
 | 
			
		||||
      header: {  }
 | 
			
		||||
      footer: {  }
 | 
			
		||||
      empty: {  }
 | 
			
		||||
      relationships: {  }
 | 
			
		||||
      arguments: {  }
 | 
			
		||||
      display_extenders: {  }
 | 
			
		||||
      group_by: true
 | 
			
		||||
      title: 'Name, Asylum and Marital Status Report'
 | 
			
		||||
    cache_metadata:
 | 
			
		||||
      max-age: -1
 | 
			
		||||
      contexts:
 | 
			
		||||
        - 'languages:language_content'
 | 
			
		||||
        - 'languages:language_interface'
 | 
			
		||||
        - user.permissions
 | 
			
		||||
      tags:
 | 
			
		||||
        - 'config:field.storage.oc_actor.field_asylum_status'
 | 
			
		||||
        - 'config:field.storage.oc_actor.field_marital_'
 | 
			
		||||
  page_1:
 | 
			
		||||
    display_plugin: page
 | 
			
		||||
    id: page_1
 | 
			
		||||
    display_title: Page
 | 
			
		||||
    position: 1
 | 
			
		||||
    display_options:
 | 
			
		||||
      display_extenders:
 | 
			
		||||
        library_in_views_display_extender:
 | 
			
		||||
          attach_library:
 | 
			
		||||
            attach_library: opencase/opencase-grouped-views
 | 
			
		||||
      path: opencase/reporting/name_and_status_changes
 | 
			
		||||
    cache_metadata:
 | 
			
		||||
      max-age: -1
 | 
			
		||||
      contexts:
 | 
			
		||||
        - 'languages:language_content'
 | 
			
		||||
        - 'languages:language_interface'
 | 
			
		||||
        - user.permissions
 | 
			
		||||
      tags:
 | 
			
		||||
        - 'config:field.storage.oc_actor.field_asylum_status'
 | 
			
		||||
        - 'config:field.storage.oc_actor.field_marital_'
 | 
			
		||||
@ -384,7 +384,21 @@ display:
 | 
			
		||||
          entity_type: oc_activity
 | 
			
		||||
          plugin_id: entity_link
 | 
			
		||||
      filters: {  }
 | 
			
		||||
      sorts: {  }
 | 
			
		||||
      sorts:
 | 
			
		||||
        activity_date_time:
 | 
			
		||||
          id: activity_date_time
 | 
			
		||||
          table: oc_activity_field_data
 | 
			
		||||
          field: activity_date_time
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          order: DESC
 | 
			
		||||
          exposed: false
 | 
			
		||||
          expose:
 | 
			
		||||
            label: ''
 | 
			
		||||
          entity_type: oc_activity
 | 
			
		||||
          entity_field: activity_date_time
 | 
			
		||||
          plugin_id: standard
 | 
			
		||||
      title: 'Activity List'
 | 
			
		||||
      header: {  }
 | 
			
		||||
      footer: {  }
 | 
			
		||||
@ -7,4 +7,5 @@ dependencies:
 | 
			
		||||
  - contact
 | 
			
		||||
  - field
 | 
			
		||||
  - opencase_entities
 | 
			
		||||
  - opencase_cases
 | 
			
		||||
  - options
 | 
			
		||||
 | 
			
		||||
@ -10,3 +10,9 @@ opencase_defaults.report_on_volunteers:
 | 
			
		||||
  parent: opencase_reporting.reporting_menu
 | 
			
		||||
  url: internal:/opencase/reporting/volunteers
 | 
			
		||||
  weight: 1
 | 
			
		||||
opencase_defaults.opencase_all_cases:
 | 
			
		||||
  title: 'Cases'
 | 
			
		||||
  menu_name: opencase
 | 
			
		||||
  parent: opencase.see_all
 | 
			
		||||
  url: internal:/opencase/all-cases
 | 
			
		||||
  weight: -1
 | 
			
		||||
 | 
			
		||||
@ -8,6 +8,7 @@
 | 
			
		||||
use Drupal\Core\Routing\RouteMatchInterface;
 | 
			
		||||
use Drupal\user\Entity\Role;
 | 
			
		||||
use Drupal\user\RoleInterface;
 | 
			
		||||
use Drupal\opencase\EntityTypeRelationsWidget;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Implements hook_help().
 | 
			
		||||
@ -25,6 +26,31 @@ function opencase_defaults_help($route_name, RouteMatchInterface $route_match) {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Implements hook_preprocess_page_title
 | 
			
		||||
 *  
 | 
			
		||||
 * Modify the page title to include more information 
 | 
			
		||||
 */
 | 
			
		||||
function opencase_defaults_preprocess_page_title(&$variables) {
 | 
			
		||||
  
 | 
			
		||||
   $route_name = \Drupal::routeMatch()->getRouteName();
 | 
			
		||||
    switch ($route_name) {
 | 
			
		||||
      case 'entity.oc_case.canonical':
 | 
			
		||||
        $case = \Drupal::routeMatch()->getParameter('oc_case');
 | 
			
		||||
        $variables['title'] = $case->getName() . ": Case Details and Files";
 | 
			
		||||
        break;
 | 
			
		||||
      case 'view.cases.page_1':
 | 
			
		||||
        $actor_id = \Drupal::routeMatch()->getParameter('actor_id');
 | 
			
		||||
        $actor = \Drupal::entityTypeManager()->getStorage('oc_actor')->load($actor_id); 
 | 
			
		||||
        $variables['title'] = $actor->getName() . ": Cases";
 | 
			
		||||
        break;
 | 
			
		||||
      case 'view.activities.page_1':
 | 
			
		||||
        $case_id = \Drupal::routeMatch()->getParameter('case_id');
 | 
			
		||||
        $case = \Drupal::entityTypeManager()->getStorage('oc_case')->load($case_id); 
 | 
			
		||||
        $variables['title'] = $case->getName() . ": Activities";
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Implements hook_theme().
 | 
			
		||||
 */
 | 
			
		||||
@ -36,3 +62,106 @@ function opencase_defaults_theme() {
 | 
			
		||||
  ];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Implements hook_block_access
 | 
			
		||||
 *
 | 
			
		||||
 * Forbids the opencase_contextual_menu block on pages where it has no content.
 | 
			
		||||
 * (Without this, it was displaying an empty sidebar)
 | 
			
		||||
 */
 | 
			
		||||
function opencase_defaults_block_access(\Drupal\block\Entity\Block $block, $operation, \Drupal\Core\Session\AccountInterface $account) {
 | 
			
		||||
  if ($operation == 'view' && $block->getPluginId() == 'opencase_contextual_menu') {
 | 
			
		||||
    $route_name = \Drupal::routeMatch()->getRouteName();
 | 
			
		||||
    $routes_where_it_should_be_shown = [
 | 
			
		||||
      'entity.oc_actor.canonical',
 | 
			
		||||
      'entity.oc_actor.edit_form',
 | 
			
		||||
      'view.cases.page_1',
 | 
			
		||||
      'entity.oc_case.canonical',
 | 
			
		||||
      'entity.oc_case.edit_form',
 | 
			
		||||
      'entity.oc_case.add_form',
 | 
			
		||||
      'view.activities.page_1',
 | 
			
		||||
      'entity.oc_activity.canonical',
 | 
			
		||||
      'entity.oc_activity.edit_form',
 | 
			
		||||
      'entity.oc_activity.add_form',
 | 
			
		||||
    ];
 | 
			
		||||
    return AccessResult::forbiddenIf(!in_array($route_name, $routes_where_it_should_be_shown))->addCacheableDependency($block);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // No opinion.
 | 
			
		||||
  return AccessResult::neutral();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function opencase_defaults_entity_base_field_info($entity_type) {
 | 
			
		||||
  $fields = array();
 | 
			
		||||
  
 | 
			
		||||
  // Add consent field to person
 | 
			
		||||
  if ($entity_type->id() === 'oc_actor') {
 | 
			
		||||
    $fields['consent'] = BaseFieldDefinition::create('boolean')
 | 
			
		||||
      ->setLabel(t('Consent to data storage'))
 | 
			
		||||
      ->setDescription(t('Has this person explicitly consented to having their personal data stored on this system?'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setDefaultValue(FALSE)
 | 
			
		||||
      ->setRequired(TRUE)
 | 
			
		||||
      ->setDisplayOptions('form', array(
 | 
			
		||||
        'type' => 'boolean_checkbox',
 | 
			
		||||
        'weight' => -6,
 | 
			
		||||
      ));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Add Involved Parties field to cases
 | 
			
		||||
  if ($entity_type->id() === 'oc_case') {
 | 
			
		||||
    $fields['actors_involved'] = BaseFieldDefinition::create('entity_reference')
 | 
			
		||||
      ->setLabel(t('Involved Parties'))
 | 
			
		||||
      ->setDescription(t('People involved in this case. To add one, start typing their name.'))
 | 
			
		||||
      ->setSetting('target_type', 'oc_actor')
 | 
			
		||||
      ->setSetting('handler', 'default')
 | 
			
		||||
      ->setTranslatable(TRUE)
 | 
			
		||||
      ->setCardinality(-1)
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'entity_reference_autocomplete',
 | 
			
		||||
        'weight' => -2,
 | 
			
		||||
        'settings' => [
 | 
			
		||||
          'match_operator' => 'CONTAINS',
 | 
			
		||||
          'size' => '60',
 | 
			
		||||
          'autocomplete_type' => 'tags',
 | 
			
		||||
          'placeholder' => '',
 | 
			
		||||
        ],
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDefaultValueCallback('opencase_defaults_actors_involved_callback')
 | 
			
		||||
      ->setRequired(TRUE);
 | 
			
		||||
  }
 | 
			
		||||
  return $fields;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * When creating a case, it sets the first involved party to the actor
 | 
			
		||||
 * id from the URL, and the second to the author's linked actor 
 | 
			
		||||
 * (if it exists and is different)
 | 
			
		||||
 */
 | 
			
		||||
function opencase_defaults_actors_involved_callback() {
 | 
			
		||||
  $author_linked_actor_id = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id())->get('field_linked_opencase_actor')->target_id;
 | 
			
		||||
  $currently_viewed_actor_id = \Drupal::request()->query->get('actor_id');
 | 
			
		||||
  return array_unique([$currently_viewed_actor_id, $author_linked_actor_id]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Implements hook_form_ID_alter
 | 
			
		||||
 */
 | 
			
		||||
function opencase_defaults_form_oc_case_type_add_form_alter(&$form, $form_state) {
 | 
			
		||||
  $widget = new EntityTypeRelationsWidget();
 | 
			
		||||
  $widget->setup($form);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Implements hook_form_ID_alter
 | 
			
		||||
 */
 | 
			
		||||
function opencase_defaults_form_oc_case_type_edit_form_alter(&$form, $form_state) {
 | 
			
		||||
  $widget = new EntityTypeRelationsWidget();
 | 
			
		||||
  $widget->setup($form);
 | 
			
		||||
  $widget->populate($form);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,7 @@ class ContextualMenu extends BlockBase {
 | 
			
		||||
        $markup = $this->actorPage();
 | 
			
		||||
        break;
 | 
			
		||||
      case 'view.cases.page_1':
 | 
			
		||||
        $markup = $this->caseListPage();
 | 
			
		||||
        $markup = $this->caseListPageForActor();
 | 
			
		||||
        break;
 | 
			
		||||
      case 'entity.oc_case.canonical':
 | 
			
		||||
      case 'entity.oc_case.edit_form':
 | 
			
		||||
@ -67,8 +67,8 @@ class ContextualMenu extends BlockBase {
 | 
			
		||||
   *    - Link to case list for that actor
 | 
			
		||||
   */
 | 
			
		||||
  private function actorPage() {
 | 
			
		||||
    $actor = \Drupal::routeMatch()->getParameter('oc_actor');
 | 
			
		||||
    $link = $this->getCaseListLink($actor);
 | 
			
		||||
    $actor_id = \Drupal::routeMatch()->getParameter('oc_actor')->id();
 | 
			
		||||
    $link = $this->getCaseListLink('oc_actor', $actor_id);
 | 
			
		||||
    return $this->asNavLinks([$link]);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -79,16 +79,17 @@ class ContextualMenu extends BlockBase {
 | 
			
		||||
   *    - Store the actor id in the session, so that the user experiences
 | 
			
		||||
   * a hierachy actor->case->activities which they can navigate
 | 
			
		||||
   */
 | 
			
		||||
  private function caseListPage() {
 | 
			
		||||
  private function caseListPageForActor() {
 | 
			
		||||
    $actor_id = \Drupal::routeMatch()->getParameter('actor_id');
 | 
			
		||||
    \Drupal::service('user.private_tempstore')->get('opencase')->set('actor_id', $actor_id);
 | 
			
		||||
    \Drupal::service('user.private_tempstore')->get('opencase')->set('parent_type', 'oc_actor');
 | 
			
		||||
    \Drupal::service('user.private_tempstore')->get('opencase')->set('parent_id', $actor_id);
 | 
			
		||||
    $actor = \Drupal::entityTypeManager()->getStorage('oc_actor')->load($actor_id);
 | 
			
		||||
    $link = $actor->toLink()->toString();
 | 
			
		||||
    $markup = $this->asNavLinks([$link]);
 | 
			
		||||
    $current_path =  \Drupal::service('path.current')->getPath();
 | 
			
		||||
    $title = "Add new case";
 | 
			
		||||
    $query = ['actor_id' => $actor_id,  'destination' => $current_path];
 | 
			
		||||
    $markup .= $this->generateLinksForAddingNewCases($actor, $title, $query);
 | 
			
		||||
    $markup .= $this->generateLinksForAddingNewCasesForActor($actor, $title, $query);
 | 
			
		||||
    return $markup; 
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -100,32 +101,40 @@ class ContextualMenu extends BlockBase {
 | 
			
		||||
   */
 | 
			
		||||
  private function casePage() {
 | 
			
		||||
    $case = \Drupal::routeMatch()->getParameter('oc_case');
 | 
			
		||||
    $actor_id = \Drupal::service('user.private_tempstore')->get('opencase')->get('actor_id');
 | 
			
		||||
    if ($actor_id) {   // there is not always one stored.
 | 
			
		||||
      $actor = \Drupal::entityTypeManager()->getStorage('oc_actor')->load($actor_id);
 | 
			
		||||
      if ($actor) {  // actor may have been deleted.
 | 
			
		||||
        $caseListLink = $this->getCaseListLink($actor);
 | 
			
		||||
      } else {
 | 
			
		||||
        $caseListLink = $this->getCaseListLinkAll();
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      $caseListLink = $this->getCaseListLinkAll();
 | 
			
		||||
    }
 | 
			
		||||
    $links = [$caseListLink, $this->getActivityListLink($case)];
 | 
			
		||||
    $links = [$this->getCaseListLinkForParentEntity(), $this->getActivityListLink($case)];
 | 
			
		||||
    return $this->asNavLinks($links); 
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Contextual menu for Add-New-Case page
 | 
			
		||||
   *    - Link to Case list for the actor that is stored in the session
 | 
			
		||||
   *    - Link to Case list for the parent entity (actor by default but plugins can change the type) 
 | 
			
		||||
   *  that is stored in the session
 | 
			
		||||
   */
 | 
			
		||||
  private function caseAddPage() {
 | 
			
		||||
    $actor_id = \Drupal::service('user.private_tempstore')->get('opencase')->get('actor_id');
 | 
			
		||||
    $actor = \Drupal::entityTypeManager()->getStorage('oc_actor')->load($actor_id);
 | 
			
		||||
    $link = $this->getCaseListLink($actor);
 | 
			
		||||
    $link = $this->getCaseListLinkForParentEntity();
 | 
			
		||||
    return $this->asNavLinks([$link]);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private function getCaseListLinkForParentEntity() {
 | 
			
		||||
    $parent_type = \Drupal::service('user.private_tempstore')->get('opencase')->get('parent_type');
 | 
			
		||||
    $parent_id = \Drupal::service('user.private_tempstore')->get('opencase')->get('parent_id');
 | 
			
		||||
    return $this->getCaseListLink($parent_type, $parent_id);
 | 
			
		||||
  }
 | 
			
		||||
  private function getCaseListLink($entity_type, $entity_id) {
 | 
			
		||||
    $url = "/opencase/$entity_type/$entity_id/case_list";
 | 
			
		||||
    $entity = \Drupal::entityTypeManager()->getStorage($entity_type)->load($entity_id);
 | 
			
		||||
    $link_text = $entity->getName(). ": Cases";
 | 
			
		||||
    return "<a href=$url>$link_text</a>";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Returns a link to the list of all cases
 | 
			
		||||
   */
 | 
			
		||||
  private function getCaseListLinkAll() {
 | 
			
		||||
    $url = Url::fromRoute('view.cases.page_2');
 | 
			
		||||
    return Link::fromTextAndUrl(t("All cases"), $url)->toString();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Contextual menu for Activity list page
 | 
			
		||||
   *     - Link to the case that the activity list is for
 | 
			
		||||
@ -173,22 +182,6 @@ class ContextualMenu extends BlockBase {
 | 
			
		||||
    return Link::fromTextAndUrl(t($case->getName() .": Activities"), $url)->toString();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Given an actor entity, returns a link to their case list 
 | 
			
		||||
   */
 | 
			
		||||
  private function getCaseListLink($actor) {
 | 
			
		||||
    $url = Url::fromRoute('view.cases.page_1', ['actor_id' => $actor->id()]);
 | 
			
		||||
    return Link::fromTextAndUrl(t($actor->getName(). ": Cases"), $url)->toString();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Returns a link to the list of all cases
 | 
			
		||||
   */
 | 
			
		||||
  private function getCaseListLinkAll() {
 | 
			
		||||
    $url = Url::fromRoute('view.cases.page_2');
 | 
			
		||||
    return Link::fromTextAndUrl(t("All cases"), $url)->toString();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Render given links as nav links div with heading
 | 
			
		||||
   */ 
 | 
			
		||||
@ -204,7 +197,7 @@ class ContextualMenu extends BlockBase {
 | 
			
		||||
  /**
 | 
			
		||||
   * returns html markup.
 | 
			
		||||
   */
 | 
			
		||||
  private function generateLinksForAddingNewCases($actor, $title, $query = []) {
 | 
			
		||||
  private function generateLinksForAddingNewCasesForActor($actor, $title, $query = []) {
 | 
			
		||||
    $actor_type = $actor->bundle();
 | 
			
		||||
    $allCaseTypes = \Drupal::service('entity_type.bundle.info')->getBundleInfo('oc_case');
 | 
			
		||||
    // $allCaseTypes is array where the key is the machine name and the value is array containing label
 | 
			
		||||
@ -10,7 +10,7 @@ field_name: field_linked_opencase_actor
 | 
			
		||||
entity_type: user
 | 
			
		||||
bundle: user
 | 
			
		||||
label: 'Person in OpenCase'
 | 
			
		||||
description: 'If this user is also a person in OpenCase (e.g. a staff member or a volunteer), start typing the name here to link them. This will ensure they have access to the right cases.'
 | 
			
		||||
description: "The person who will use this login; for example, a staff member or a volunteer. If they are not in the system yet, you will need to create them first and then come back here to set up their user account." 
 | 
			
		||||
required: false
 | 
			
		||||
translatable: false
 | 
			
		||||
default_value: {  }
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										12
									
								
								modules/opencase_entities/config/schema/oc_event.schema.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								modules/opencase_entities/config/schema/oc_event.schema.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,12 @@
 | 
			
		||||
opencase_entities.oc_event.*:
 | 
			
		||||
  type: config_entity
 | 
			
		||||
  label: 'Event config'
 | 
			
		||||
  mapping:
 | 
			
		||||
    id:
 | 
			
		||||
      type: string
 | 
			
		||||
      label: 'ID'
 | 
			
		||||
    label:
 | 
			
		||||
      type: label
 | 
			
		||||
      label: 'Label'
 | 
			
		||||
    uuid:
 | 
			
		||||
      type: string
 | 
			
		||||
@ -0,0 +1,12 @@
 | 
			
		||||
opencase_entities.oc_event_type.*:
 | 
			
		||||
  type: config_entity
 | 
			
		||||
  label: 'Event type config'
 | 
			
		||||
  mapping:
 | 
			
		||||
    id:
 | 
			
		||||
      type: string
 | 
			
		||||
      label: 'ID'
 | 
			
		||||
    label:
 | 
			
		||||
      type: label
 | 
			
		||||
      label: 'Label'
 | 
			
		||||
    uuid:
 | 
			
		||||
      type: string
 | 
			
		||||
@ -0,0 +1,12 @@
 | 
			
		||||
opencase_entities.oc_organisation_type.*:
 | 
			
		||||
  type: config_entity
 | 
			
		||||
  label: 'Organisation type config'
 | 
			
		||||
  mapping:
 | 
			
		||||
    id:
 | 
			
		||||
      type: string
 | 
			
		||||
      label: 'ID'
 | 
			
		||||
    label:
 | 
			
		||||
      type: label
 | 
			
		||||
      label: 'Label'
 | 
			
		||||
    uuid:
 | 
			
		||||
      type: string
 | 
			
		||||
@ -22,9 +22,23 @@ use Drupal\Core\Render\Element;
 | 
			
		||||
function template_preprocess_oc_activity(array &$variables) {
 | 
			
		||||
  // Fetch OCActivity Entity Object.
 | 
			
		||||
  $oc_activity = $variables['elements']['#oc_activity'];
 | 
			
		||||
  $variables['id'] = $oc_activity->get('id')[0]->get('value')->getValue();
 | 
			
		||||
 | 
			
		||||
  // Helpful $content variable for templates.
 | 
			
		||||
  foreach (Element::children($variables['elements']) as $key) {
 | 
			
		||||
    $variables['content'][$key] = $variables['elements'][$key];
 | 
			
		||||
  }
 | 
			
		||||
  // Separate the fields into two sections to be displayed in two columns.
 | 
			
		||||
  // Remove the name (title) field as this is displayed anyway.
 | 
			
		||||
  $variables['base_fields'] = array();
 | 
			
		||||
  $variables['other_fields'] = array();
 | 
			
		||||
  foreach (Element::children($variables['elements']) as $key) {
 | 
			
		||||
    $variables['content'][$key] = $variables['elements'][$key];
 | 
			
		||||
    if (in_array($key, ['activity_date_time', 'time_taken', 'description', 'user_id', 'actors_involved'])) {
 | 
			
		||||
      $variables['base_fields'][$key] = $variables['elements'][$key];
 | 
			
		||||
    } else {
 | 
			
		||||
      $variables['other_fields'][$key] = $variables['elements'][$key];
 | 
			
		||||
      unset($variables['other_fields']['name']);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -20,11 +20,17 @@ use Drupal\Core\Render\Element;
 | 
			
		||||
 *   - attributes: HTML attributes for the containing element.
 | 
			
		||||
 */
 | 
			
		||||
function template_preprocess_oc_actor(array &$variables) {
 | 
			
		||||
  // Fetch OCActor Entity Object.
 | 
			
		||||
  $oc_actor = $variables['elements']['#oc_actor'];
 | 
			
		||||
 | 
			
		||||
  // Helpful $content variable for templates.
 | 
			
		||||
  // Make the id available to the template and also separate the fields
 | 
			
		||||
  // into two sections to be displayed in two columns.
 | 
			
		||||
  $variables['id'] = $variables['elements']['#oc_actor']->get('id')[0]->get('value')->getValue();
 | 
			
		||||
  $variables['contact_details'] = array();
 | 
			
		||||
  $variables['fields_other_than_contact_details'] = array();
 | 
			
		||||
  foreach (Element::children($variables['elements']) as $key) {
 | 
			
		||||
    $variables['content'][$key] = $variables['elements'][$key];
 | 
			
		||||
    if (in_array($key, ['email', 'phone', 'phone2', 'postal_address', 'post_code'])) {
 | 
			
		||||
      $variables['contact_details'][$key] = $variables['elements'][$key];
 | 
			
		||||
    } else {
 | 
			
		||||
      $variables['fields_other_than_contact_details'][$key] = $variables['elements'][$key];
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										30
									
								
								modules/opencase_entities/oc_bank_account.page.inc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								modules/opencase_entities/oc_bank_account.page.inc
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,30 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file
 | 
			
		||||
 * Contains oc_bank_account.page.inc.
 | 
			
		||||
 *
 | 
			
		||||
 * Page callback for Bank Account entities.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Render\Element;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Prepares variables for Bank Account templates.
 | 
			
		||||
 *
 | 
			
		||||
 * Default template: oc_bank_account.html.twig.
 | 
			
		||||
 *
 | 
			
		||||
 * @param array $variables
 | 
			
		||||
 *   An associative array containing:
 | 
			
		||||
 *   - elements: An associative array containing the user information and any
 | 
			
		||||
 *   - attributes: HTML attributes for the containing element.
 | 
			
		||||
 */
 | 
			
		||||
function template_preprocess_oc_bank_account(array &$variables) {
 | 
			
		||||
  // Fetch OCBankAccount Entity Object.
 | 
			
		||||
  $oc_bank_account = $variables['elements']['#oc_bank_account'];
 | 
			
		||||
 | 
			
		||||
  // Helpful $content variable for templates.
 | 
			
		||||
  foreach (Element::children($variables['elements']) as $key) {
 | 
			
		||||
    $variables['content'][$key] = $variables['elements'][$key];
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@ -2,26 +2,26 @@
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file
 | 
			
		||||
 * Contains oc_case.page.inc.
 | 
			
		||||
 * Contains oc_event.page.inc.
 | 
			
		||||
 *
 | 
			
		||||
 * Page callback for Case entities.
 | 
			
		||||
 * Page callback for Event entities.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Render\Element;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Prepares variables for Case templates.
 | 
			
		||||
 * Prepares variables for Event templates.
 | 
			
		||||
 *
 | 
			
		||||
 * Default template: oc_case.html.twig.
 | 
			
		||||
 * Default template: oc_event.html.twig.
 | 
			
		||||
 *
 | 
			
		||||
 * @param array $variables
 | 
			
		||||
 *   An associative array containing:
 | 
			
		||||
 *   - elements: An associative array containing the user information and any
 | 
			
		||||
 *   - attributes: HTML attributes for the containing element.
 | 
			
		||||
 */
 | 
			
		||||
function template_preprocess_oc_case(array &$variables) {
 | 
			
		||||
  // Fetch OCCase Entity Object.
 | 
			
		||||
  $oc_case = $variables['elements']['#oc_case'];
 | 
			
		||||
function template_preprocess_oc_event(array &$variables) {
 | 
			
		||||
  // Fetch OCEvent Entity Object.
 | 
			
		||||
  $oc_event = $variables['elements']['#oc_event'];
 | 
			
		||||
 | 
			
		||||
  // Helpful $content variable for templates.
 | 
			
		||||
  foreach (Element::children($variables['elements']) as $key) {
 | 
			
		||||
							
								
								
									
										30
									
								
								modules/opencase_entities/oc_organisation.page.inc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								modules/opencase_entities/oc_organisation.page.inc
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,30 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file
 | 
			
		||||
 * Contains oc_organisation.page.inc.
 | 
			
		||||
 *
 | 
			
		||||
 * Page callback for Organisation entities.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Render\Element;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Prepares variables for Organisation templates.
 | 
			
		||||
 *
 | 
			
		||||
 * Default template: oc_organisation.html.twig.
 | 
			
		||||
 *
 | 
			
		||||
 * @param array $variables
 | 
			
		||||
 *   An associative array containing:
 | 
			
		||||
 *   - elements: An associative array containing the user information and any
 | 
			
		||||
 *   - attributes: HTML attributes for the containing element.
 | 
			
		||||
 */
 | 
			
		||||
function template_preprocess_oc_organisation(array &$variables) {
 | 
			
		||||
  // Fetch OCOrganisation Entity Object.
 | 
			
		||||
  $oc_organisation = $variables['elements']['#oc_organisation'];
 | 
			
		||||
 | 
			
		||||
  // Helpful $content variable for templates.
 | 
			
		||||
  foreach (Element::children($variables['elements']) as $key) {
 | 
			
		||||
    $variables['content'][$key] = $variables['elements'][$key];
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@ -1,14 +1,74 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
use \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchemaConverter;
 | 
			
		||||
 | 
			
		||||
function opencase_entities_update_80198() {
 | 
			
		||||
    $field_storage_definition = \Drupal\Core\Field\BaseFieldDefinition::create('file')
 | 
			
		||||
      ->setLabel(t('Files'))
 | 
			
		||||
      ->setDescription(t('Files relating to this organisation'))
 | 
			
		||||
      ->setSetting('file_directory', '[date:custom:Y]-[date:custom:m]')
 | 
			
		||||
      ->setSetting('handler', 'default:file')
 | 
			
		||||
      ->setSetting('file_extensions', 'txt jpg jpeg gif rtf xls xlsx doc swf png pdf docx csv')
 | 
			
		||||
      ->setSetting('description_field', 'true')
 | 
			
		||||
      ->setSetting('uri_scheme', 'private')
 | 
			
		||||
      ->setCardinality(-1)
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'file_generic',
 | 
			
		||||
        'weight' => 61,
 | 
			
		||||
        'settings' => [
 | 
			
		||||
          'progress_indicator' => 'throbber',
 | 
			
		||||
        ],
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'settings' => ['use_description_as_link_text' => 'true']
 | 
			
		||||
      ]);
 | 
			
		||||
 | 
			
		||||
  \Drupal::entityDefinitionUpdateManager()
 | 
			
		||||
    ->installFieldStorageDefinition('organisation_files', 'oc_organisation', 'opencase_entities', $field_storage_definition);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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',
 | 
			
		||||
    \Drupal::entityTypeManager(),
 | 
			
		||||
    \Drupal::entityDefinitionUpdateManager(),
 | 
			
		||||
    \Drupal::service('entity.last_installed_schema.repository'),
 | 
			
		||||
    \Drupal::keyValue('entity.storage_schema.sql'),
 | 
			
		||||
    \Drupal::database()
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $contact_details_fields = ['email', 'phone', 'phone2', 'postal_address', 'post_code'];
 | 
			
		||||
  $schema_converter->convertToRevisionable($sandbox, $contact_details_fields);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function opencase_entities_update_8016() {
 | 
			
		||||
  $update_manager = \Drupal::entityDefinitionUpdateManager();
 | 
			
		||||
  $definition = $update_manager->getFieldStorageDefinition('activity_date_time', 'oc_activity');
 | 
			
		||||
  $update_manager->updateFieldStorageDefinition($definition);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Add 'activity_date_time' field to 'oc_activity' entities.
 | 
			
		||||
 */
 | 
			
		||||
function opencase_entities_update_8003() {
 | 
			
		||||
  $storage_definition =  \Drupal\Core\Field\BaseFieldDefinition::create('datetime')
 | 
			
		||||
      ->setLabel(t('Date and time'))
 | 
			
		||||
      ->setDescription(t('When the activity started.'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setDefaultValueCallback('Drupal\opencase_entities\Entity\OCActivity::currentDateTime')
 | 
			
		||||
      ->setDefaultValueCallback('\Drupal\opencase_entities\Entity\OCActivity::currentDateTime')
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'type' => 'datetime_default',
 | 
			
		||||
        'settings' => [
 | 
			
		||||
@ -25,4 +85,3 @@ function opencase_entities_update_8003() {
 | 
			
		||||
  \Drupal::entityDefinitionUpdateManager()
 | 
			
		||||
    ->installFieldStorageDefinition('activity_date_time', 'oc_activity', 'oc_activity', $storage_definition);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -9,17 +9,6 @@ entity.oc_actor_type.add_form:
 | 
			
		||||
  appears_on:
 | 
			
		||||
    - entity.oc_actor_type.collection
 | 
			
		||||
 | 
			
		||||
entity.oc_case.add_form:
 | 
			
		||||
  route_name: entity.oc_case.add_page
 | 
			
		||||
  title: 'Add Case'
 | 
			
		||||
  appears_on:
 | 
			
		||||
    - entity.oc_case.collection
 | 
			
		||||
entity.oc_case_type.add_form:
 | 
			
		||||
  route_name: entity.oc_case_type.add_form
 | 
			
		||||
  title: 'Add Case type'
 | 
			
		||||
  appears_on:
 | 
			
		||||
    - entity.oc_case_type.collection
 | 
			
		||||
 | 
			
		||||
entity.oc_activity.add_form:
 | 
			
		||||
  route_name: entity.oc_activity.add_page
 | 
			
		||||
  title: 'Add Activity'
 | 
			
		||||
@ -31,3 +20,28 @@ entity.oc_activity_type.add_form:
 | 
			
		||||
  appears_on:
 | 
			
		||||
    - entity.oc_activity_type.collection
 | 
			
		||||
 | 
			
		||||
entity.oc_organisation.add_form:
 | 
			
		||||
  route_name: entity.oc_organisation.add_page
 | 
			
		||||
  title: 'Add Organisation'
 | 
			
		||||
  appears_on:
 | 
			
		||||
    - entity.oc_organisation.collection
 | 
			
		||||
entity.oc_organisation_type.add_form:
 | 
			
		||||
  route_name: entity.oc_organisation_type.add_form
 | 
			
		||||
  title: 'Add Organisation type'
 | 
			
		||||
  appears_on:
 | 
			
		||||
    - entity.oc_organisation_type.collection
 | 
			
		||||
entity.oc_event.add_form:
 | 
			
		||||
  route_name: entity.oc_event.add_page
 | 
			
		||||
  title: 'Add Event'
 | 
			
		||||
  appears_on:
 | 
			
		||||
    - entity.oc_event.collection
 | 
			
		||||
entity.oc_event_type.add_form:
 | 
			
		||||
  route_name: entity.oc_event_type.add_form
 | 
			
		||||
  title: 'Add Event type'
 | 
			
		||||
  appears_on:
 | 
			
		||||
    - entity.oc_event_type.collection
 | 
			
		||||
entity.oc_bank_account.add_form:
 | 
			
		||||
  route_name: entity.oc_bank_account.add_form
 | 
			
		||||
  title: 'Add Bank Account'
 | 
			
		||||
  appears_on:
 | 
			
		||||
    - entity.oc_bank_account.collection
 | 
			
		||||
 | 
			
		||||
@ -17,24 +17,6 @@ entity.oc_actor_type.collection:
 | 
			
		||||
  weight: 99
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Case menu items definition
 | 
			
		||||
entity.oc_case.collection:
 | 
			
		||||
  title: 'Case list'
 | 
			
		||||
  route_name: entity.oc_case.collection
 | 
			
		||||
  description: 'List Case entities'
 | 
			
		||||
  parent: system.admin_structure
 | 
			
		||||
  weight: 100
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Case type menu items definition
 | 
			
		||||
entity.oc_case_type.collection:
 | 
			
		||||
  title: 'Case type'
 | 
			
		||||
  route_name: entity.oc_case_type.collection
 | 
			
		||||
  description: 'List Case type (bundles)'
 | 
			
		||||
  parent: system.admin_structure
 | 
			
		||||
  weight: 99
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Activity menu items definition
 | 
			
		||||
entity.oc_activity.collection:
 | 
			
		||||
  title: 'Activity list'
 | 
			
		||||
@ -52,3 +34,51 @@ entity.oc_activity_type.collection:
 | 
			
		||||
  parent: system.admin_structure
 | 
			
		||||
  weight: 99
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Organisation menu items definition
 | 
			
		||||
entity.oc_organisation.collection:
 | 
			
		||||
  title: 'Organisation list'
 | 
			
		||||
  route_name: entity.oc_organisation.collection
 | 
			
		||||
  description: 'List Organisation entities'
 | 
			
		||||
  parent: system.admin_structure
 | 
			
		||||
  weight: 100
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Organisation type menu items definition
 | 
			
		||||
entity.oc_organisation_type.collection:
 | 
			
		||||
  title: 'Organisation type'
 | 
			
		||||
  route_name: entity.oc_organisation_type.collection
 | 
			
		||||
  description: 'List Organisation type (bundles)'
 | 
			
		||||
  parent: system.admin_structure
 | 
			
		||||
  weight: 99
 | 
			
		||||
 | 
			
		||||
# Event menu items definition
 | 
			
		||||
entity.oc_event.collection:
 | 
			
		||||
  title: 'Event list'
 | 
			
		||||
  route_name: entity.oc_event.collection
 | 
			
		||||
  description: 'List Event entities'
 | 
			
		||||
  parent: system.admin_structure
 | 
			
		||||
  weight: 100
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Event type menu items definition
 | 
			
		||||
entity.oc_event_type.collection:
 | 
			
		||||
  title: 'Event type'
 | 
			
		||||
  route_name: entity.oc_event_type.collection
 | 
			
		||||
  description: 'List Event type (bundles)'
 | 
			
		||||
  parent: system.admin_structure
 | 
			
		||||
  weight: 99
 | 
			
		||||
 | 
			
		||||
# Bank Account menu items definition
 | 
			
		||||
entity.oc_bank_account.collection:
 | 
			
		||||
  title: 'Bank Account list'
 | 
			
		||||
  route_name: entity.oc_bank_account.collection
 | 
			
		||||
  description: 'List Bank Account entities'
 | 
			
		||||
  parent: system.admin_structure
 | 
			
		||||
  weight: 100
 | 
			
		||||
 | 
			
		||||
oc_bank_account.admin.structure.settings:
 | 
			
		||||
  title: 'Bank Account settings'
 | 
			
		||||
  description: 'Configure Bank Account entities'
 | 
			
		||||
  route_name: oc_bank_account.settings
 | 
			
		||||
  parent: system.admin_structure
 | 
			
		||||
 | 
			
		||||
@ -21,28 +21,6 @@ entity.oc_actor.delete_form:
 | 
			
		||||
  title: Delete
 | 
			
		||||
  weight: 10
 | 
			
		||||
 | 
			
		||||
# Case routing definition
 | 
			
		||||
 | 
			
		||||
entity.oc_case.canonical:
 | 
			
		||||
  route_name: entity.oc_case.canonical
 | 
			
		||||
  base_route: entity.oc_case.canonical
 | 
			
		||||
  title: 'View'
 | 
			
		||||
 | 
			
		||||
entity.oc_case.edit_form:
 | 
			
		||||
  route_name: entity.oc_case.edit_form
 | 
			
		||||
  base_route: entity.oc_case.canonical
 | 
			
		||||
  title: 'Edit'
 | 
			
		||||
 | 
			
		||||
entity.oc_case.version_history:
 | 
			
		||||
  route_name: entity.oc_case.version_history
 | 
			
		||||
  base_route: entity.oc_case.canonical
 | 
			
		||||
  title: 'Revisions'
 | 
			
		||||
 | 
			
		||||
entity.oc_case.delete_form:
 | 
			
		||||
  route_name:  entity.oc_case.delete_form
 | 
			
		||||
  base_route:  entity.oc_case.canonical
 | 
			
		||||
  title: Delete
 | 
			
		||||
  weight: 10
 | 
			
		||||
 | 
			
		||||
# Activity routing definition
 | 
			
		||||
 | 
			
		||||
@ -67,3 +45,63 @@ entity.oc_activity.delete_form:
 | 
			
		||||
  title: Delete
 | 
			
		||||
  weight: 10
 | 
			
		||||
 | 
			
		||||
# Organisation routing definition
 | 
			
		||||
 | 
			
		||||
entity.oc_organisation.canonical:
 | 
			
		||||
  route_name: entity.oc_organisation.canonical
 | 
			
		||||
  base_route: entity.oc_organisation.canonical
 | 
			
		||||
  title: 'View'
 | 
			
		||||
 | 
			
		||||
entity.oc_organisation.edit_form:
 | 
			
		||||
  route_name: entity.oc_organisation.edit_form
 | 
			
		||||
  base_route: entity.oc_organisation.canonical
 | 
			
		||||
  title: 'Edit'
 | 
			
		||||
 | 
			
		||||
entity.oc_organisation.version_history:
 | 
			
		||||
  route_name: entity.oc_organisation.version_history
 | 
			
		||||
  base_route: entity.oc_organisation.canonical
 | 
			
		||||
  title: 'Revisions'
 | 
			
		||||
 | 
			
		||||
entity.oc_organisation.delete_form:
 | 
			
		||||
  route_name:  entity.oc_organisation.delete_form
 | 
			
		||||
  base_route:  entity.oc_organisation.canonical
 | 
			
		||||
  title: Delete
 | 
			
		||||
  weight: 10
 | 
			
		||||
# Event routing definition
 | 
			
		||||
 | 
			
		||||
entity.oc_event.canonical:
 | 
			
		||||
  route_name: entity.oc_event.canonical
 | 
			
		||||
  base_route: entity.oc_event.canonical
 | 
			
		||||
  title: 'View'
 | 
			
		||||
 | 
			
		||||
entity.oc_event.edit_form:
 | 
			
		||||
  route_name: entity.oc_event.edit_form
 | 
			
		||||
  base_route: entity.oc_event.canonical
 | 
			
		||||
  title: 'Edit'
 | 
			
		||||
 | 
			
		||||
entity.oc_event.delete_form:
 | 
			
		||||
  route_name:  entity.oc_event.delete_form
 | 
			
		||||
  base_route:  entity.oc_event.canonical
 | 
			
		||||
  title: Delete
 | 
			
		||||
  weight: 10
 | 
			
		||||
# Bank Account routing definition
 | 
			
		||||
oc_bank_account.settings_tab:
 | 
			
		||||
  route_name: oc_bank_account.settings
 | 
			
		||||
  title: 'Settings'
 | 
			
		||||
  base_route: oc_bank_account.settings
 | 
			
		||||
 | 
			
		||||
entity.oc_bank_account.canonical:
 | 
			
		||||
  route_name: entity.oc_bank_account.canonical
 | 
			
		||||
  base_route: entity.oc_bank_account.canonical
 | 
			
		||||
  title: 'View'
 | 
			
		||||
 | 
			
		||||
entity.oc_bank_account.edit_form:
 | 
			
		||||
  route_name: entity.oc_bank_account.edit_form
 | 
			
		||||
  base_route: entity.oc_bank_account.canonical
 | 
			
		||||
  title: 'Edit'
 | 
			
		||||
 | 
			
		||||
entity.oc_bank_account.delete_form:
 | 
			
		||||
  route_name:  entity.oc_bank_account.delete_form
 | 
			
		||||
  base_route:  entity.oc_bank_account.canonical
 | 
			
		||||
  title: Delete
 | 
			
		||||
  weight: 10
 | 
			
		||||
 | 
			
		||||
@ -42,16 +42,6 @@ function opencase_entities_theme() {
 | 
			
		||||
    'variables' => ['content' => NULL],
 | 
			
		||||
    'file' => 'oc_actor.page.inc',
 | 
			
		||||
  ];
 | 
			
		||||
  $theme['oc_case'] = [
 | 
			
		||||
    'render element' => 'elements',
 | 
			
		||||
    'file' => 'oc_case.page.inc',
 | 
			
		||||
    'template' => 'oc_case',
 | 
			
		||||
  ];
 | 
			
		||||
  $theme['oc_case_content_add_list'] = [
 | 
			
		||||
    'render element' => 'content',
 | 
			
		||||
    'variables' => ['content' => NULL],
 | 
			
		||||
    'file' => 'oc_case.page.inc',
 | 
			
		||||
  ];
 | 
			
		||||
  $theme['oc_activity'] = [
 | 
			
		||||
    'render element' => 'elements',
 | 
			
		||||
    'file' => 'oc_activity.page.inc',
 | 
			
		||||
@ -62,6 +52,26 @@ function opencase_entities_theme() {
 | 
			
		||||
    'variables' => ['content' => NULL],
 | 
			
		||||
    'file' => 'oc_activity.page.inc',
 | 
			
		||||
  ];
 | 
			
		||||
  $theme['oc_organisation'] = [
 | 
			
		||||
    'render element' => 'elements',
 | 
			
		||||
    'file' => 'oc_organisation.page.inc',
 | 
			
		||||
    'template' => 'oc_organisation',
 | 
			
		||||
  ];
 | 
			
		||||
  $theme['oc_organisation_content_add_list'] = [
 | 
			
		||||
    'render element' => 'content',
 | 
			
		||||
    'variables' => ['content' => NULL],
 | 
			
		||||
    'file' => 'oc_organisation.page.inc',
 | 
			
		||||
  ];
 | 
			
		||||
  $theme['oc_event'] = [
 | 
			
		||||
    'render element' => 'elements',
 | 
			
		||||
    'file' => 'oc_event.page.inc',
 | 
			
		||||
    'template' => 'oc_event',
 | 
			
		||||
  ];
 | 
			
		||||
  $theme['oc_event_content_add_list'] = [
 | 
			
		||||
    'render element' => 'content',
 | 
			
		||||
    'variables' => ['content' => NULL],
 | 
			
		||||
    'file' => 'oc_event.page.inc',
 | 
			
		||||
  ];
 | 
			
		||||
  return $theme;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -81,22 +91,6 @@ function opencase_entities_theme_suggestions_oc_actor(array $variables) {
 | 
			
		||||
  return $suggestions;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* Implements hook_theme_suggestions_HOOK().
 | 
			
		||||
*/
 | 
			
		||||
function opencase_entities_theme_suggestions_oc_case(array $variables) {
 | 
			
		||||
  $suggestions = [];
 | 
			
		||||
  $entity = $variables['elements']['#oc_case'];
 | 
			
		||||
  $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
 | 
			
		||||
 | 
			
		||||
  $suggestions[] = 'oc_case__' . $sanitized_view_mode;
 | 
			
		||||
  $suggestions[] = 'oc_case__' . $entity->bundle();
 | 
			
		||||
  $suggestions[] = 'oc_case__' . $entity->bundle() . '__' . $sanitized_view_mode;
 | 
			
		||||
  $suggestions[] = 'oc_case__' . $entity->id();
 | 
			
		||||
  $suggestions[] = 'oc_case__' . $entity->id() . '__' . $sanitized_view_mode;
 | 
			
		||||
  return $suggestions;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* Implements hook_theme_suggestions_HOOK().
 | 
			
		||||
*/
 | 
			
		||||
@ -113,29 +107,36 @@ function opencase_entities_theme_suggestions_oc_activity(array $variables) {
 | 
			
		||||
  return $suggestions;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function opencase_views_query_alter(Drupal\views\ViewExecutable $view, $query) {
 | 
			
		||||
  if ($view->getBaseEntityType() && $view->getBaseEntityType()->id() == 'oc_case') {
 | 
			
		||||
    $query->addTag('oc_case_access');
 | 
			
		||||
  }
 | 
			
		||||
  if ($view->getBaseEntityType() && $view->getBaseEntityType()->id() == 'oc_activity') {
 | 
			
		||||
    $query->addTag('oc_activity_access');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Implements hook_theme_suggestions_HOOK().
 | 
			
		||||
 */
 | 
			
		||||
function opencase_entities_theme_suggestions_oc_organisation(array $variables) {
 | 
			
		||||
  $suggestions = [];
 | 
			
		||||
  $entity = $variables['elements']['#oc_organisation'];
 | 
			
		||||
  $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
 | 
			
		||||
 | 
			
		||||
  $suggestions[] = 'oc_organisation__' . $sanitized_view_mode;
 | 
			
		||||
  $suggestions[] = 'oc_organisation__' . $entity->bundle();
 | 
			
		||||
  $suggestions[] = 'oc_organisation__' . $entity->bundle() . '__' . $sanitized_view_mode;
 | 
			
		||||
  $suggestions[] = 'oc_organisation__' . $entity->id();
 | 
			
		||||
  $suggestions[] = 'oc_organisation__' . $entity->id() . '__' . $sanitized_view_mode;
 | 
			
		||||
  return $suggestions;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function opencase_query_oc_case_access_alter($query) {
 | 
			
		||||
  if (\Drupal::currentUser()->hasPermission('view published case entities')) {
 | 
			
		||||
    return;
 | 
			
		||||
  } 
 | 
			
		||||
  $linked_actor_id = CaseInvolvement::getLinkedActorId(\Drupal::currentUser());
 | 
			
		||||
  $query->addJoin('INNER', 'oc_case__actors_involved', 'access_filter', 'access_filter.entity_id = oc_case_field_data.id');
 | 
			
		||||
  $query->condition('access_filter.actors_involved_target_id', $linked_actor_id);
 | 
			
		||||
/**
 | 
			
		||||
 * Implements hook_theme_suggestions_HOOK().
 | 
			
		||||
 */
 | 
			
		||||
function opencase_entities_theme_suggestions_oc_event(array $variables) {
 | 
			
		||||
  $suggestions = [];
 | 
			
		||||
  $entity = $variables['elements']['#oc_event'];
 | 
			
		||||
  $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
 | 
			
		||||
 | 
			
		||||
  $suggestions[] = 'oc_event__' . $sanitized_view_mode;
 | 
			
		||||
  $suggestions[] = 'oc_event__' . $entity->bundle();
 | 
			
		||||
  $suggestions[] = 'oc_event__' . $entity->bundle() . '__' . $sanitized_view_mode;
 | 
			
		||||
  $suggestions[] = 'oc_event__' . $entity->id();
 | 
			
		||||
  $suggestions[] = 'oc_event__' . $entity->id() . '__' . $sanitized_view_mode;
 | 
			
		||||
  return $suggestions;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function opencase_query_oc_activity_access_alter($query) {
 | 
			
		||||
  if (\Drupal::currentUser()->hasPermission('view published case entities')) {
 | 
			
		||||
    return;
 | 
			
		||||
  } 
 | 
			
		||||
  $linked_actor_id = CaseInvolvement::getLinkedActorId(\Drupal::currentUser());
 | 
			
		||||
  $query->addJoin('INNER', 'oc_case__actors_involved', 'access_filter', 'access_filter.entity_id = oc_activity_field_data.oc_case');
 | 
			
		||||
  $query->condition('access_filter.actors_involved_target_id', $linked_actor_id);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -5,9 +5,14 @@ view edit delete all actor entities:
 | 
			
		||||
  title: 'View/Edit/Delete all types of people'
 | 
			
		||||
  description: ''
 | 
			
		||||
 | 
			
		||||
administer opencase entity bundles:
 | 
			
		||||
  title: 'Administer OpenCase Actor/Case/Activity Types'
 | 
			
		||||
  description: 'Create, configure and delete types of actor (such as "Client" or "Legal Advisor"), types of case (such as "Housing" or "Asylum") and types of activity (such as "Case Note" or "Interview")'
 | 
			
		||||
administer actor bundles:
 | 
			
		||||
  title: 'Administer OpenCase Person Types'
 | 
			
		||||
 | 
			
		||||
administer case bundles:
 | 
			
		||||
  title: 'Administer OpenCase Case Types'
 | 
			
		||||
 | 
			
		||||
administer activity bundles:
 | 
			
		||||
  title: 'Administer OpenCase Activity Types'
 | 
			
		||||
 | 
			
		||||
administer actor entities:
 | 
			
		||||
  title: 'Administer Actor entities'
 | 
			
		||||
@ -45,6 +50,11 @@ revert all case revisions:
 | 
			
		||||
delete all case revisions:
 | 
			
		||||
  title: 'Delete all revisions'
 | 
			
		||||
  description: 'Role requires permission to <em>view Case revisions</em> and <em>delete rights</em> for case entities in question or <em>administer case entities</em>.'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
view published activity entities:
 | 
			
		||||
  title: 'View published Activity entities'
 | 
			
		||||
 | 
			
		||||
add activity entities:
 | 
			
		||||
  title: 'Create new Activity entities'
 | 
			
		||||
 | 
			
		||||
@ -72,3 +82,78 @@ revert all activity revisions:
 | 
			
		||||
delete all activity revisions:
 | 
			
		||||
  title: 'Delete all revisions'
 | 
			
		||||
  description: 'Role requires permission to <em>view Activity revisions</em> and <em>delete rights</em> for activity entities in question or <em>administer activity entities</em>.'
 | 
			
		||||
add organisation entities:
 | 
			
		||||
  title: 'Create new Organisation entities'
 | 
			
		||||
 | 
			
		||||
administer organisation entities:
 | 
			
		||||
  title: 'Administer Organisation entities'
 | 
			
		||||
  description: 'Allow to access the administration form to configure Organisation entities.'
 | 
			
		||||
  restrict access: true
 | 
			
		||||
 | 
			
		||||
delete organisation entities:
 | 
			
		||||
  title: 'Delete Organisation entities'
 | 
			
		||||
 | 
			
		||||
edit organisation entities:
 | 
			
		||||
  title: 'Edit Organisation entities'
 | 
			
		||||
 | 
			
		||||
view published organisation entities:
 | 
			
		||||
  title: 'View published Organisation entities'
 | 
			
		||||
 | 
			
		||||
view unpublished organisation entities:
 | 
			
		||||
  title: 'View unpublished Organisation entities'
 | 
			
		||||
 | 
			
		||||
view all organisation revisions:
 | 
			
		||||
  title: 'View all Organisation revisions'
 | 
			
		||||
 | 
			
		||||
revert all organisation revisions:
 | 
			
		||||
  title: 'Revert all Organisation revisions'
 | 
			
		||||
  description: 'Role requires permission <em>view Organisation revisions</em> and <em>edit rights</em> for organisation entities in question or <em>administer organisation entities</em>.'
 | 
			
		||||
 | 
			
		||||
delete all organisation revisions:
 | 
			
		||||
  title: 'Delete all revisions'
 | 
			
		||||
  description: 'Role requires permission to <em>view Organisation revisions</em> and <em>delete rights</em> for organisation entities in question or <em>administer organisation entities</em>.'
 | 
			
		||||
 | 
			
		||||
permission_callbacks:
 | 
			
		||||
  - \Drupal\opencase_entities\OCOrganisationPermissions::generatePermissions
 | 
			
		||||
add event entities:
 | 
			
		||||
  title: 'Create new Event entities'
 | 
			
		||||
 | 
			
		||||
administer event entities:
 | 
			
		||||
  title: 'Administer Event entities'
 | 
			
		||||
  description: 'Allow to access the administration form to configure Event entities.'
 | 
			
		||||
  restrict access: true
 | 
			
		||||
 | 
			
		||||
delete event entities:
 | 
			
		||||
  title: 'Delete Event entities'
 | 
			
		||||
 | 
			
		||||
edit event entities:
 | 
			
		||||
  title: 'Edit Event entities'
 | 
			
		||||
 | 
			
		||||
view published event entities:
 | 
			
		||||
  title: 'View published Event entities'
 | 
			
		||||
 | 
			
		||||
view unpublished event entities:
 | 
			
		||||
  title: 'View unpublished Event entities'
 | 
			
		||||
 | 
			
		||||
permission_callbacks:
 | 
			
		||||
  - \Drupal\opencase_entities\OCEventPermissions::generatePermissions
 | 
			
		||||
add bank account entities:
 | 
			
		||||
  title: 'Create new Bank Account entities'
 | 
			
		||||
 | 
			
		||||
administer bank account entities:
 | 
			
		||||
  title: 'Administer Bank Account entities'
 | 
			
		||||
  description: 'Allow to access the administration form to configure Bank Account entities.'
 | 
			
		||||
  restrict access: true
 | 
			
		||||
 | 
			
		||||
delete bank account entities:
 | 
			
		||||
  title: 'Delete Bank Account entities'
 | 
			
		||||
 | 
			
		||||
edit bank account entities:
 | 
			
		||||
  title: 'Edit Bank Account entities'
 | 
			
		||||
 | 
			
		||||
view published bank account entities:
 | 
			
		||||
  title: 'View published Bank Account entities'
 | 
			
		||||
 | 
			
		||||
view unpublished bank account entities:
 | 
			
		||||
  title: 'View unpublished Bank Account entities'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,209 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Controller;
 | 
			
		||||
 | 
			
		||||
use Drupal\Component\Utility\Xss;
 | 
			
		||||
use Drupal\Core\Controller\ControllerBase;
 | 
			
		||||
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
 | 
			
		||||
use Drupal\Core\Url;
 | 
			
		||||
use Drupal\opencase_entities\Entity\OCOrganisationInterface;
 | 
			
		||||
use Symfony\Component\DependencyInjection\ContainerInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class OCOrganisationController.
 | 
			
		||||
 *
 | 
			
		||||
 *  Returns responses for Organisation routes.
 | 
			
		||||
 */
 | 
			
		||||
class OCOrganisationController extends ControllerBase implements ContainerInjectionInterface {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The date formatter.
 | 
			
		||||
   *
 | 
			
		||||
   * @var \Drupal\Core\Datetime\DateFormatter
 | 
			
		||||
   */
 | 
			
		||||
  protected $dateFormatter;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The renderer.
 | 
			
		||||
   *
 | 
			
		||||
   * @var \Drupal\Core\Render\Renderer
 | 
			
		||||
   */
 | 
			
		||||
  protected $renderer;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public static function create(ContainerInterface $container) {
 | 
			
		||||
    $instance = parent::create($container);
 | 
			
		||||
    $instance->dateFormatter = $container->get('date.formatter');
 | 
			
		||||
    $instance->renderer = $container->get('renderer');
 | 
			
		||||
    return $instance;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Displays a Organisation revision.
 | 
			
		||||
   *
 | 
			
		||||
   * @param int $oc_organisation_revision
 | 
			
		||||
   *   The Organisation revision ID.
 | 
			
		||||
   *
 | 
			
		||||
   * @return array
 | 
			
		||||
   *   An array suitable for drupal_render().
 | 
			
		||||
   */
 | 
			
		||||
  public function revisionShow($oc_organisation_revision) {
 | 
			
		||||
    $oc_organisation = $this->entityTypeManager()->getStorage('oc_organisation')
 | 
			
		||||
      ->loadRevision($oc_organisation_revision);
 | 
			
		||||
    $view_builder = $this->entityTypeManager()->getViewBuilder('oc_organisation');
 | 
			
		||||
 | 
			
		||||
    return $view_builder->view($oc_organisation);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Page title callback for a Organisation revision.
 | 
			
		||||
   *
 | 
			
		||||
   * @param int $oc_organisation_revision
 | 
			
		||||
   *   The Organisation revision ID.
 | 
			
		||||
   *
 | 
			
		||||
   * @return string
 | 
			
		||||
   *   The page title.
 | 
			
		||||
   */
 | 
			
		||||
  public function revisionPageTitle($oc_organisation_revision) {
 | 
			
		||||
    $oc_organisation = $this->entityTypeManager()->getStorage('oc_organisation')
 | 
			
		||||
      ->loadRevision($oc_organisation_revision);
 | 
			
		||||
    return $this->t('Revision of %title from %date', [
 | 
			
		||||
      '%title' => $oc_organisation->label(),
 | 
			
		||||
      '%date' => $this->dateFormatter->format($oc_organisation->getRevisionCreationTime()),
 | 
			
		||||
    ]);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Generates an overview table of older revisions of a Organisation.
 | 
			
		||||
   *
 | 
			
		||||
   * @param \Drupal\opencase_entities\Entity\OCOrganisationInterface $oc_organisation
 | 
			
		||||
   *   A Organisation object.
 | 
			
		||||
   *
 | 
			
		||||
   * @return array
 | 
			
		||||
   *   An array as expected by drupal_render().
 | 
			
		||||
   */
 | 
			
		||||
  public function revisionOverview(OCOrganisationInterface $oc_organisation) {
 | 
			
		||||
    $account = $this->currentUser();
 | 
			
		||||
    $oc_organisation_storage = $this->entityTypeManager()->getStorage('oc_organisation');
 | 
			
		||||
 | 
			
		||||
    $langcode = $oc_organisation->language()->getId();
 | 
			
		||||
    $langname = $oc_organisation->language()->getName();
 | 
			
		||||
    $languages = $oc_organisation->getTranslationLanguages();
 | 
			
		||||
    $has_translations = (count($languages) > 1);
 | 
			
		||||
    $build['#title'] = $has_translations ? $this->t('@langname revisions for %title', ['@langname' => $langname, '%title' => $oc_organisation->label()]) : $this->t('Revisions for %title', ['%title' => $oc_organisation->label()]);
 | 
			
		||||
 | 
			
		||||
    $header = [$this->t('Revision'), $this->t('Operations')];
 | 
			
		||||
    $revert_permission = (($account->hasPermission("revert all organisation revisions") || $account->hasPermission('administer organisation entities')));
 | 
			
		||||
    $delete_permission = (($account->hasPermission("delete all organisation revisions") || $account->hasPermission('administer organisation entities')));
 | 
			
		||||
 | 
			
		||||
    $rows = [];
 | 
			
		||||
 | 
			
		||||
    $vids = $oc_organisation_storage->revisionIds($oc_organisation);
 | 
			
		||||
 | 
			
		||||
    $latest_revision = TRUE;
 | 
			
		||||
 | 
			
		||||
    foreach (array_reverse($vids) as $vid) {
 | 
			
		||||
      /** @var \Drupal\opencase_entities\OCOrganisationInterface $revision */
 | 
			
		||||
      $revision = $oc_organisation_storage->loadRevision($vid);
 | 
			
		||||
      // Only show revisions that are affected by the language that is being
 | 
			
		||||
      // displayed.
 | 
			
		||||
      if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) {
 | 
			
		||||
        $username = [
 | 
			
		||||
          '#theme' => 'username',
 | 
			
		||||
          '#account' => $revision->getRevisionUser(),
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        // Use revision link to link to revisions that are not active.
 | 
			
		||||
        $date = $this->dateFormatter->format($revision->getRevisionCreationTime(), 'short');
 | 
			
		||||
        if ($vid != $oc_organisation->getRevisionId()) {
 | 
			
		||||
          $link = $this->l($date, new Url('entity.oc_organisation.revision', [
 | 
			
		||||
            'oc_organisation' => $oc_organisation->id(),
 | 
			
		||||
            'oc_organisation_revision' => $vid,
 | 
			
		||||
          ]));
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
          $link = $oc_organisation->link($date);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $row = [];
 | 
			
		||||
        $column = [
 | 
			
		||||
          'data' => [
 | 
			
		||||
            '#type' => 'inline_template',
 | 
			
		||||
            '#template' => '{% trans %}{{ date }} by {{ username }}{% endtrans %}{% if message %}<p class="revision-log">{{ message }}</p>{% endif %}',
 | 
			
		||||
            '#context' => [
 | 
			
		||||
              'date' => $link,
 | 
			
		||||
              'username' => $this->renderer->renderPlain($username),
 | 
			
		||||
              'message' => [
 | 
			
		||||
                '#markup' => $revision->getRevisionLogMessage(),
 | 
			
		||||
                '#allowed_tags' => Xss::getHtmlTagList(),
 | 
			
		||||
              ],
 | 
			
		||||
            ],
 | 
			
		||||
          ],
 | 
			
		||||
        ];
 | 
			
		||||
        $row[] = $column;
 | 
			
		||||
 | 
			
		||||
        if ($latest_revision) {
 | 
			
		||||
          $row[] = [
 | 
			
		||||
            'data' => [
 | 
			
		||||
              '#prefix' => '<em>',
 | 
			
		||||
              '#markup' => $this->t('Current revision'),
 | 
			
		||||
              '#suffix' => '</em>',
 | 
			
		||||
            ],
 | 
			
		||||
          ];
 | 
			
		||||
          foreach ($row as &$current) {
 | 
			
		||||
            $current['class'] = ['revision-current'];
 | 
			
		||||
          }
 | 
			
		||||
          $latest_revision = FALSE;
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
          $links = [];
 | 
			
		||||
          if ($revert_permission) {
 | 
			
		||||
            $links['revert'] = [
 | 
			
		||||
              'title' => $this->t('Revert'),
 | 
			
		||||
              'url' => $has_translations ?
 | 
			
		||||
              Url::fromRoute('entity.oc_organisation.translation_revert', [
 | 
			
		||||
                'oc_organisation' => $oc_organisation->id(),
 | 
			
		||||
                'oc_organisation_revision' => $vid,
 | 
			
		||||
                'langcode' => $langcode,
 | 
			
		||||
              ]) :
 | 
			
		||||
              Url::fromRoute('entity.oc_organisation.revision_revert', [
 | 
			
		||||
                'oc_organisation' => $oc_organisation->id(),
 | 
			
		||||
                'oc_organisation_revision' => $vid,
 | 
			
		||||
              ]),
 | 
			
		||||
            ];
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          if ($delete_permission) {
 | 
			
		||||
            $links['delete'] = [
 | 
			
		||||
              'title' => $this->t('Delete'),
 | 
			
		||||
              'url' => Url::fromRoute('entity.oc_organisation.revision_delete', [
 | 
			
		||||
                'oc_organisation' => $oc_organisation->id(),
 | 
			
		||||
                'oc_organisation_revision' => $vid,
 | 
			
		||||
              ]),
 | 
			
		||||
            ];
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          $row[] = [
 | 
			
		||||
            'data' => [
 | 
			
		||||
              '#type' => 'operations',
 | 
			
		||||
              '#links' => $links,
 | 
			
		||||
            ],
 | 
			
		||||
          ];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $rows[] = $row;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $build['oc_organisation_revisions_table'] = [
 | 
			
		||||
      '#theme' => 'table',
 | 
			
		||||
      '#rows' => $rows,
 | 
			
		||||
      '#header' => $header,
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    return $build;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -80,13 +80,12 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
 | 
			
		||||
   * When creating an activity, it sets the case id from the URL.
 | 
			
		||||
   */
 | 
			
		||||
  public static function defaultVal() {
 | 
			
		||||
    return array(\Drupal::request()->query->get('case_id'));
 | 
			
		||||
    return array(\Drupal::request()->query->get('actor_id'));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public static function currentDateTime() {
 | 
			
		||||
    $current_time = DrupalDateTime::createFromTimestamp(time());
 | 
			
		||||
    $formatted = $current_time->format(DateTimeItem::DATETIME_STORAGE_FORMAT);
 | 
			
		||||
    \Drupal::logger("nr_debug")->notice($formatted);
 | 
			
		||||
    $formatted = $current_time->format('Y-m-d');
 | 
			
		||||
    return $formatted;
 | 
			
		||||
  }
 | 
			
		||||
  /**
 | 
			
		||||
@ -220,15 +219,19 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
 | 
			
		||||
 | 
			
		||||
    $fields['activity_date_time'] = BaseFieldDefinition::create('datetime')
 | 
			
		||||
      ->setLabel(t('Date and time'))
 | 
			
		||||
      ->setDescription('')
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setRequired(TRUE)
 | 
			
		||||
      ->setDefaultValueCallback('Drupal\opencase_entities\Entity\OCActivity::currentDateTime')
 | 
			
		||||
      ->setDefaultValueCallback('\Drupal\opencase_entities\Entity\OCActivity::currentDateTime')
 | 
			
		||||
      ->setDisplayConfigurable('form', true)
 | 
			
		||||
      ->setDisplayConfigurable('view', true)
 | 
			
		||||
      ->setSettings([
 | 
			
		||||
          'datetime_type' => 'date'
 | 
			
		||||
        ])
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'datetime_default',
 | 
			
		||||
        'settings' => [
 | 
			
		||||
          'format_type' => 'medium',
 | 
			
		||||
          'format_type' => 'short',
 | 
			
		||||
        ],
 | 
			
		||||
        'weight' => -3,
 | 
			
		||||
      ])
 | 
			
		||||
@ -265,6 +268,8 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDefaultValue('')
 | 
			
		||||
      ->setDisplayConfigurable('form', true)
 | 
			
		||||
      ->setDisplayConfigurable('view', true)
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'hidden',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
@ -276,18 +281,8 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
 | 
			
		||||
      ])
 | 
			
		||||
      ->setRequired(TRUE);
 | 
			
		||||
 | 
			
		||||
    $fields['oc_case'] = BaseFieldDefinition::create('entity_reference')
 | 
			
		||||
      ->setLabel(t('Case'))
 | 
			
		||||
      ->setDescription(t('The case this activity belongs to.'))
 | 
			
		||||
      ->setSetting('target_type', 'oc_case')
 | 
			
		||||
      ->setSetting('handler', 'default')
 | 
			
		||||
      ->setTranslatable(TRUE)
 | 
			
		||||
      ->setCardinality(1)
 | 
			
		||||
      ->setDefaultValueCallback('Drupal\opencase_entities\Entity\OCActivity::defaultVal')
 | 
			
		||||
      ->setRequired(TRUE);
 | 
			
		||||
 | 
			
		||||
    $fields['description'] = BaseFieldDefinition::create('string_long')
 | 
			
		||||
      ->setLabel(t('Description'))
 | 
			
		||||
      ->setLabel(t('Notes'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSettings([
 | 
			
		||||
        'max_length' => 50,
 | 
			
		||||
@ -311,6 +306,8 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
 | 
			
		||||
      ->setSettings([
 | 
			
		||||
        'suffix' => 'minutes',
 | 
			
		||||
      ])
 | 
			
		||||
      ->SetDisplayConfigurable("form", true)
 | 
			
		||||
      ->SetDisplayConfigurable("view", true)
 | 
			
		||||
      ->setDefaultValue('')
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
 | 
			
		||||
@ -24,7 +24,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
 | 
			
		||||
 *     },
 | 
			
		||||
 *   },
 | 
			
		||||
 *   config_prefix = "oc_activity_type",
 | 
			
		||||
 *   admin_permission = "administer opencase entity bundles",
 | 
			
		||||
 *   admin_permission = "administer activity bundles",
 | 
			
		||||
 *   bundle_of = "oc_activity",
 | 
			
		||||
 *   entity_keys = {
 | 
			
		||||
 *     "id" = "id",
 | 
			
		||||
 | 
			
		||||
@ -114,11 +114,15 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
 | 
			
		||||
        $translation->setOwnerId(0);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    $name = $this->get('first_name')->value . ' ';
 | 
			
		||||
    if ($this->get('middle_names')->value) $name .= $this->get('middle_names')->value . ' ';
 | 
			
		||||
    $name .= $this->get('last_name')->value . ' ';
 | 
			
		||||
    $name .= '(' . $this->bundle() . ')';
 | 
			
		||||
     
 | 
			
		||||
    if ($this->get('full_name')->value) {
 | 
			
		||||
      $name = $this->get('full_name')->value . ' ';
 | 
			
		||||
    } else {
 | 
			
		||||
      $name = $this->get('first_name')->value . ' ';
 | 
			
		||||
      if ($this->get('middle_names')->value) $name .= $this->get('middle_names')->value . ' ';
 | 
			
		||||
      $name .= $this->get('last_name')->value . ' ';
 | 
			
		||||
    }
 | 
			
		||||
    $name .= '(' . $this->type->entity->label() . ')';
 | 
			
		||||
  
 | 
			
		||||
    $this->setName($name);
 | 
			
		||||
 | 
			
		||||
@ -231,12 +235,25 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSetting('target_type', 'user')
 | 
			
		||||
      ->setSetting('handler', 'default')
 | 
			
		||||
      ->setTranslatable(TRUE)
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'inline',
 | 
			
		||||
        'type' => 'author',
 | 
			
		||||
        'weight' => -10,
 | 
			
		||||
      ]);
 | 
			
		||||
      ->setTranslatable(TRUE);
 | 
			
		||||
 | 
			
		||||
    // When configuring a person type, you will need to choose whether to have full name or first and last name fields displayed.
 | 
			
		||||
    $fields['full_name'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setDescription(t('The person\'s name.'))
 | 
			
		||||
      ->setLabel(t('Name'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSettings([
 | 
			
		||||
        'max_length' => 100,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayConfigurable("form", true)
 | 
			
		||||
      ->setDisplayConfigurable("view", true)
 | 
			
		||||
      ->setDefaultValue('')
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => -50,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setRequired(TRUE);
 | 
			
		||||
 | 
			
		||||
    $fields['first_name'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setLabel(t('First Name'))
 | 
			
		||||
@ -246,17 +263,13 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
 | 
			
		||||
        'max_length' => 20,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayConfigurable("form", true)
 | 
			
		||||
      ->setDisplayConfigurable("view", true)
 | 
			
		||||
      ->setDefaultValue('')
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => -9,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => -9,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setRequired(TRUE);
 | 
			
		||||
      ]);
 | 
			
		||||
 | 
			
		||||
    $fields['middle_names'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setLabel(t('Middle Names'))
 | 
			
		||||
@ -266,12 +279,9 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
 | 
			
		||||
        'max_length' => 50,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayConfigurable("form", true)
 | 
			
		||||
      ->setDisplayConfigurable("view", true)
 | 
			
		||||
      ->setDefaultValue('')
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => -8,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => -8,
 | 
			
		||||
@ -282,42 +292,28 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
 | 
			
		||||
      ->setLabel(t('Last Name'))
 | 
			
		||||
      ->setDescription(t("The person's last name"))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setDisplayConfigurable("form", true)
 | 
			
		||||
      ->setDisplayConfigurable("view", true)
 | 
			
		||||
      ->setSettings([
 | 
			
		||||
        'max_length' => 20,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDefaultValue('')
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => -7,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => -7,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setRequired(TRUE);
 | 
			
		||||
 | 
			
		||||
    $fields['consent'] = BaseFieldDefinition::create('boolean')
 | 
			
		||||
      ->setLabel(t('Consent to data storage'))
 | 
			
		||||
      ->setDescription(t('Has this person explicitly consented to having their personal data stored on this system?'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setDefaultValue(FALSE)
 | 
			
		||||
      ->setRequired(TRUE)
 | 
			
		||||
      ->setDisplayOptions('form', array(
 | 
			
		||||
        'type' => 'boolean_checkbox',
 | 
			
		||||
        'weight' => -6,
 | 
			
		||||
      ));
 | 
			
		||||
      ]);
 | 
			
		||||
 | 
			
		||||
    // Contact details.
 | 
			
		||||
    // so it is not exposed to user configuration. 
 | 
			
		||||
    $fields['email'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setLabel(t('Email Address'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSettings(array(
 | 
			
		||||
        'default_value' => '',
 | 
			
		||||
        'max_length' => 30,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayConfigurable('form', true)
 | 
			
		||||
      ->setDisplayOptions('view', array(
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
@ -329,6 +325,7 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
 | 
			
		||||
      ));
 | 
			
		||||
    $fields['phone'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setLabel(t('Main Phone Number'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSettings(array(
 | 
			
		||||
        'default_value' => '',
 | 
			
		||||
        'max_length' => 20,
 | 
			
		||||
@ -344,6 +341,7 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
 | 
			
		||||
        'weight' => -4,
 | 
			
		||||
      ));
 | 
			
		||||
    $fields['phone2'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setLabel(t('Alternative Phone Number'))
 | 
			
		||||
      ->setSettings(array(
 | 
			
		||||
        'default_value' => '',
 | 
			
		||||
@ -360,6 +358,7 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
 | 
			
		||||
        'weight' => -3,
 | 
			
		||||
      ));
 | 
			
		||||
    $fields['postal_address'] = BaseFieldDefinition::create('string_long')
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setLabel(t('Postal Address'))
 | 
			
		||||
      ->setDescription(t('Full address, apart from post code.'))
 | 
			
		||||
      ->setSettings(array(
 | 
			
		||||
@ -377,6 +376,7 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
 | 
			
		||||
        'weight' => -2,
 | 
			
		||||
      ));
 | 
			
		||||
    $fields['post_code'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setLabel(t('Post Code'))
 | 
			
		||||
      ->setSettings(array(
 | 
			
		||||
        'default_value' => '',
 | 
			
		||||
@ -408,6 +408,13 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setTranslatable(TRUE);
 | 
			
		||||
 | 
			
		||||
    $fields['user_login'] = BaseFieldDefinition::create('boolean')
 | 
			
		||||
      ->setLabel(t('Login Access'))
 | 
			
		||||
      ->setDescription(t('Whether this person should be able to log into the system.'))
 | 
			
		||||
      ->setDisplayConfigurable('form', true)
 | 
			
		||||
      ->setDisplayConfigurable('display', true)
 | 
			
		||||
      ->setDefaultValue(FALSE);
 | 
			
		||||
 | 
			
		||||
    return $fields;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -24,7 +24,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
 | 
			
		||||
 *     },
 | 
			
		||||
 *   },
 | 
			
		||||
 *   config_prefix = "oc_actor_type",
 | 
			
		||||
 *   admin_permission = "administer opencase entity bundles",
 | 
			
		||||
 *   admin_permission = "administer actor bundles",
 | 
			
		||||
 *   bundle_of = "oc_actor",
 | 
			
		||||
 *   entity_keys = {
 | 
			
		||||
 *     "id" = "id",
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										227
									
								
								modules/opencase_entities/src/Entity/OCBankAccount.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										227
									
								
								modules/opencase_entities/src/Entity/OCBankAccount.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,227 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\EntityStorageInterface;
 | 
			
		||||
use Drupal\Core\Field\BaseFieldDefinition;
 | 
			
		||||
use Drupal\Core\Entity\ContentEntityBase;
 | 
			
		||||
use Drupal\Core\Entity\EntityChangedTrait;
 | 
			
		||||
use Drupal\Core\Entity\EntityPublishedTrait;
 | 
			
		||||
use Drupal\Core\Entity\EntityTypeInterface;
 | 
			
		||||
use Drupal\user\UserInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Defines the Bank Account entity.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 *
 | 
			
		||||
 * @ContentEntityType(
 | 
			
		||||
 *   id = "oc_bank_account",
 | 
			
		||||
 *   label = @Translation("Bank Account"),
 | 
			
		||||
 *   handlers = {
 | 
			
		||||
 *     "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
 | 
			
		||||
 *     "list_builder" = "Drupal\opencase_entities\OCBankAccountListBuilder",
 | 
			
		||||
 *     "views_data" = "Drupal\opencase_entities\Entity\OCBankAccountViewsData",
 | 
			
		||||
 *
 | 
			
		||||
 *     "form" = {
 | 
			
		||||
 *       "default" = "Drupal\opencase_entities\Form\OCBankAccountForm",
 | 
			
		||||
 *       "add" = "Drupal\opencase_entities\Form\OCBankAccountForm",
 | 
			
		||||
 *       "edit" = "Drupal\opencase_entities\Form\OCBankAccountForm",
 | 
			
		||||
 *       "delete" = "Drupal\opencase_entities\Form\OCBankAccountDeleteForm",
 | 
			
		||||
 *     },
 | 
			
		||||
 *     "route_provider" = {
 | 
			
		||||
 *       "html" = "Drupal\opencase_entities\OCBankAccountHtmlRouteProvider",
 | 
			
		||||
 *     },
 | 
			
		||||
 *     "access" = "Drupal\opencase_entities\OCBankAccountAccessControlHandler",
 | 
			
		||||
 *   },
 | 
			
		||||
 *   base_table = "oc_bank_account",
 | 
			
		||||
 *   translatable = FALSE,
 | 
			
		||||
 *   admin_permission = "administer bank account entities",
 | 
			
		||||
 *   entity_keys = {
 | 
			
		||||
 *     "id" = "id",
 | 
			
		||||
 *     "label" = "name",
 | 
			
		||||
 *     "uuid" = "uuid",
 | 
			
		||||
 *     "uid" = "user_id",
 | 
			
		||||
 *     "langcode" = "langcode",
 | 
			
		||||
 *     "published" = "status",
 | 
			
		||||
 *   },
 | 
			
		||||
 *   links = {
 | 
			
		||||
 *     "canonical" = "/admin/opencase/oc_bank_account/{oc_bank_account}",
 | 
			
		||||
 *     "add-form" = "/admin/opencase/oc_bank_account/add",
 | 
			
		||||
 *     "edit-form" = "/admin/opencase/oc_bank_account/{oc_bank_account}/edit",
 | 
			
		||||
 *     "delete-form" = "/admin/opencase/oc_bank_account/{oc_bank_account}/delete",
 | 
			
		||||
 *     "collection" = "/admin/opencase/oc_bank_account",
 | 
			
		||||
 *   },
 | 
			
		||||
 *   field_ui_base_route = "oc_bank_account.settings"
 | 
			
		||||
 * )
 | 
			
		||||
 */
 | 
			
		||||
class OCBankAccount extends ContentEntityBase implements OCBankAccountInterface {
 | 
			
		||||
 | 
			
		||||
  use EntityChangedTrait;
 | 
			
		||||
  use EntityPublishedTrait;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
 | 
			
		||||
    parent::preCreate($storage_controller, $values);
 | 
			
		||||
    $values += [
 | 
			
		||||
      'user_id' => \Drupal::currentUser()->id(),
 | 
			
		||||
    ];
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getName() {
 | 
			
		||||
    return $this->get('name')->value;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function setName($name) {
 | 
			
		||||
    $this->set('name', $name);
 | 
			
		||||
    return $this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getCreatedTime() {
 | 
			
		||||
    return $this->get('created')->value;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function setCreatedTime($timestamp) {
 | 
			
		||||
    $this->set('created', $timestamp);
 | 
			
		||||
    return $this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getOwner() {
 | 
			
		||||
    return $this->get('user_id')->entity;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getOwnerId() {
 | 
			
		||||
    return $this->get('user_id')->target_id;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function setOwnerId($uid) {
 | 
			
		||||
    $this->set('user_id', $uid);
 | 
			
		||||
    return $this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function setOwner(UserInterface $account) {
 | 
			
		||||
    $this->set('user_id', $account->id());
 | 
			
		||||
    return $this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
 | 
			
		||||
    $fields = parent::baseFieldDefinitions($entity_type);
 | 
			
		||||
 | 
			
		||||
    // Add the published field.
 | 
			
		||||
    $fields += static::publishedBaseFieldDefinitions($entity_type);
 | 
			
		||||
 | 
			
		||||
    $fields['user_id'] = BaseFieldDefinition::create('entity_reference')
 | 
			
		||||
      ->setLabel(t('Authored by'))
 | 
			
		||||
      ->setDescription(t('The user ID of author of the Bank Account entity.'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSetting('target_type', 'user')
 | 
			
		||||
      ->setSetting('handler', 'default');
 | 
			
		||||
 | 
			
		||||
    $fields['name'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setLabel(t('Name'))
 | 
			
		||||
      ->setSettings([
 | 
			
		||||
        'max_length' => 50,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDefaultValue('')
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => -4,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => -4,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayConfigurable('form', TRUE)
 | 
			
		||||
      ->setDisplayConfigurable('view', TRUE)
 | 
			
		||||
      ->setRequired(TRUE);
 | 
			
		||||
 | 
			
		||||
    $fields['account_number'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setLabel(t('Account Number'))
 | 
			
		||||
      ->setSettings([
 | 
			
		||||
        'max_length' => 50,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDefaultValue('')
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => -3,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => -3,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayConfigurable('form', TRUE)
 | 
			
		||||
      ->setDisplayConfigurable('view', TRUE)
 | 
			
		||||
      ->setRequired(TRUE);
 | 
			
		||||
 | 
			
		||||
    $fields['sort_code'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setLabel(t('Sort Code'))
 | 
			
		||||
      ->setSettings([
 | 
			
		||||
        'max_length' => 50,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDefaultValue('')
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => -2,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => -2,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayConfigurable('form', TRUE)
 | 
			
		||||
      ->setDisplayConfigurable('view', TRUE)
 | 
			
		||||
      ->setRequired(TRUE);
 | 
			
		||||
 | 
			
		||||
    $fields['status']->setDescription(t('A boolean indicating whether the Bank Account is published.'))
 | 
			
		||||
      //->setDisplayOptions('form', [
 | 
			
		||||
      //  'type' => 'boolean_checkbox',
 | 
			
		||||
      //  'weight' => -1,
 | 
			
		||||
      //])
 | 
			
		||||
      ;
 | 
			
		||||
 | 
			
		||||
    $fields['created'] = BaseFieldDefinition::create('created')
 | 
			
		||||
      ->setLabel(t('Created'))
 | 
			
		||||
      ->setDescription(t('The time that the entity was created.'));
 | 
			
		||||
 | 
			
		||||
    $fields['changed'] = BaseFieldDefinition::create('changed')
 | 
			
		||||
      ->setLabel(t('Changed'))
 | 
			
		||||
      ->setDescription(t('The time that the entity was last edited.'));
 | 
			
		||||
 | 
			
		||||
    return $fields;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,59 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\ContentEntityInterface;
 | 
			
		||||
use Drupal\Core\Entity\EntityChangedInterface;
 | 
			
		||||
use Drupal\Core\Entity\EntityPublishedInterface;
 | 
			
		||||
use Drupal\user\EntityOwnerInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provides an interface for defining Bank Account entities.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 */
 | 
			
		||||
interface OCBankAccountInterface extends ContentEntityInterface, EntityChangedInterface, EntityPublishedInterface, EntityOwnerInterface {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Add get/set methods for your configuration properties here.
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Gets the Bank Account name.
 | 
			
		||||
   *
 | 
			
		||||
   * @return string
 | 
			
		||||
   *   Name of the Bank Account.
 | 
			
		||||
   */
 | 
			
		||||
  public function getName();
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Sets the Bank Account name.
 | 
			
		||||
   *
 | 
			
		||||
   * @param string $name
 | 
			
		||||
   *   The Bank Account name.
 | 
			
		||||
   *
 | 
			
		||||
   * @return \Drupal\opencase_entities\Entity\OCBankAccountInterface
 | 
			
		||||
   *   The called Bank Account entity.
 | 
			
		||||
   */
 | 
			
		||||
  public function setName($name);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Gets the Bank Account creation timestamp.
 | 
			
		||||
   *
 | 
			
		||||
   * @return int
 | 
			
		||||
   *   Creation timestamp of the Bank Account.
 | 
			
		||||
   */
 | 
			
		||||
  public function getCreatedTime();
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Sets the Bank Account creation timestamp.
 | 
			
		||||
   *
 | 
			
		||||
   * @param int $timestamp
 | 
			
		||||
   *   The Bank Account creation timestamp.
 | 
			
		||||
   *
 | 
			
		||||
   * @return \Drupal\opencase_entities\Entity\OCBankAccountInterface
 | 
			
		||||
   *   The called Bank Account entity.
 | 
			
		||||
   */
 | 
			
		||||
  public function setCreatedTime($timestamp);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,23 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\views\EntityViewsData;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provides Views data for Bank Account entities.
 | 
			
		||||
 */
 | 
			
		||||
class OCBankAccountViewsData extends EntityViewsData {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getViewsData() {
 | 
			
		||||
    $data = parent::getViewsData();
 | 
			
		||||
 | 
			
		||||
    // Additional information for Views integration, such as table joins, can be
 | 
			
		||||
    // put here.
 | 
			
		||||
    return $data;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										250
									
								
								modules/opencase_entities/src/Entity/OCEvent.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										250
									
								
								modules/opencase_entities/src/Entity/OCEvent.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,250 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\EntityStorageInterface;
 | 
			
		||||
use Drupal\Core\Field\BaseFieldDefinition;
 | 
			
		||||
use Drupal\Core\Entity\ContentEntityBase;
 | 
			
		||||
use Drupal\Core\Entity\EntityChangedTrait;
 | 
			
		||||
use Drupal\Core\Entity\EntityPublishedTrait;
 | 
			
		||||
use Drupal\Core\Entity\EntityTypeInterface;
 | 
			
		||||
use Drupal\datetime\Plugin\Field\FieldType\DateTimeItem;
 | 
			
		||||
use Drupal\Core\Datetime\DrupalDateTime;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Defines the Event entity.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 *
 | 
			
		||||
 * @ContentEntityType(
 | 
			
		||||
 *   id = "oc_event",
 | 
			
		||||
 *   label = @Translation("Event"),
 | 
			
		||||
 *   bundle_label = @Translation("Event type"),
 | 
			
		||||
 *   handlers = {
 | 
			
		||||
 *     "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
 | 
			
		||||
 *     "list_builder" = "Drupal\opencase_entities\OCEventListBuilder",
 | 
			
		||||
 *     "views_data" = "Drupal\opencase_entities\Entity\OCEventViewsData",
 | 
			
		||||
 *
 | 
			
		||||
 *     "form" = {
 | 
			
		||||
 *       "default" = "Drupal\opencase_entities\Form\OCEventForm",
 | 
			
		||||
 *       "add" = "Drupal\opencase_entities\Form\OCEventForm",
 | 
			
		||||
 *       "edit" = "Drupal\opencase_entities\Form\OCEventForm",
 | 
			
		||||
 *       "delete" = "Drupal\opencase_entities\Form\OCEventDeleteForm",
 | 
			
		||||
 *     },
 | 
			
		||||
 *     "route_provider" = {
 | 
			
		||||
 *       "html" = "Drupal\opencase_entities\OCEventHtmlRouteProvider",
 | 
			
		||||
 *     },
 | 
			
		||||
 *     "access" = "Drupal\opencase_entities\OCEventAccessControlHandler",
 | 
			
		||||
 *   },
 | 
			
		||||
 *   base_table = "oc_event",
 | 
			
		||||
 *   translatable = FALSE,
 | 
			
		||||
 *   permission_granularity = "bundle",
 | 
			
		||||
 *   admin_permission = "administer event entities",
 | 
			
		||||
 *   entity_keys = {
 | 
			
		||||
 *     "id" = "id",
 | 
			
		||||
 *     "bundle" = "type",
 | 
			
		||||
 *     "label" = "name",
 | 
			
		||||
 *     "uuid" = "uuid",
 | 
			
		||||
 *     "uid" = "user_id",
 | 
			
		||||
 *     "langcode" = "langcode",
 | 
			
		||||
 *     "published" = "status",
 | 
			
		||||
 *   },
 | 
			
		||||
 *   links = {
 | 
			
		||||
 *     "canonical" = "/opencase/oc_event/{oc_event}",
 | 
			
		||||
 *     "add-page" = "/opencase/oc_event/add",
 | 
			
		||||
 *     "add-form" = "/opencase/oc_event/add/{oc_event_type}",
 | 
			
		||||
 *     "edit-form" = "/opencase/oc_event/{oc_event}/edit",
 | 
			
		||||
 *     "delete-form" = "/opencase/oc_event/{oc_event}/delete",
 | 
			
		||||
 *     "collection" = "/opencase/oc_event",
 | 
			
		||||
 *   },
 | 
			
		||||
 *   bundle_entity_type = "oc_event_type",
 | 
			
		||||
 *   field_ui_base_route = "entity.oc_event_type.edit_form"
 | 
			
		||||
 * )
 | 
			
		||||
 */
 | 
			
		||||
class OCEvent extends ContentEntityBase implements OCEventInterface {
 | 
			
		||||
 | 
			
		||||
  use EntityChangedTrait;
 | 
			
		||||
  use EntityPublishedTrait;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getName() {
 | 
			
		||||
    return $this->get('name')->value;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function setName($name) {
 | 
			
		||||
    $this->set('name', $name);
 | 
			
		||||
    return $this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getCreatedTime() {
 | 
			
		||||
    return $this->get('created')->value;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function setCreatedTime($timestamp) {
 | 
			
		||||
    $this->set('created', $timestamp);
 | 
			
		||||
    return $this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getOwner() {
 | 
			
		||||
    return $this->get('user_id')->entity;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getOwnerId() {
 | 
			
		||||
    return $this->get('user_id')->target_id;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function setOwnerId($uid) {
 | 
			
		||||
    $this->set('user_id', $uid);
 | 
			
		||||
    return $this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
 | 
			
		||||
    parent::preCreate($storage_controller, $values);
 | 
			
		||||
    $values += [
 | 
			
		||||
      'user_id' => \Drupal::currentUser()->id(),
 | 
			
		||||
    ];
 | 
			
		||||
  }
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function setOwner(UserInterface $account) {
 | 
			
		||||
    $this->set('user_id', $account->id());
 | 
			
		||||
    return $this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
 | 
			
		||||
    $fields = parent::baseFieldDefinitions($entity_type);
 | 
			
		||||
 | 
			
		||||
    // Add the published field.
 | 
			
		||||
    $fields += static::publishedBaseFieldDefinitions($entity_type);
 | 
			
		||||
 | 
			
		||||
    $fields['user_id'] = BaseFieldDefinition::create('entity_reference')
 | 
			
		||||
      ->setLabel(t('Entered by'))
 | 
			
		||||
      ->setDescription(t('The user ID of author of the Event entity.'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSetting('target_type', 'user')
 | 
			
		||||
      ->setSetting('handler', 'default')
 | 
			
		||||
      ->setTranslatable(TRUE)
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'inline',
 | 
			
		||||
        'type' => 'author',
 | 
			
		||||
        'weight' => -4,
 | 
			
		||||
      ]);
 | 
			
		||||
 | 
			
		||||
    $fields['name'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setLabel(t('Name'))
 | 
			
		||||
      ->setDescription(t('The name of the Event entity.'))
 | 
			
		||||
      ->setSettings([
 | 
			
		||||
        'max_length' => 50,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDefaultValue('')
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => -4,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => -4,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayConfigurable('form', TRUE)
 | 
			
		||||
      ->setDisplayConfigurable('view', TRUE)
 | 
			
		||||
      ->setRequired(TRUE);
 | 
			
		||||
 | 
			
		||||
    $fields['status']->setDescription(t('A boolean indicating whether the Event is published.'));
 | 
			
		||||
 | 
			
		||||
    $fields['created'] = BaseFieldDefinition::create('created')
 | 
			
		||||
      ->setLabel(t('Created'))
 | 
			
		||||
      ->setDescription(t('The time that the entity was created.'));
 | 
			
		||||
 | 
			
		||||
    $fields['changed'] = BaseFieldDefinition::create('changed')
 | 
			
		||||
      ->setLabel(t('Changed'))
 | 
			
		||||
      ->setDescription(t('The time that the entity was last edited.'));
 | 
			
		||||
 | 
			
		||||
    $fields['activity_date_time'] = BaseFieldDefinition::create('datetime')
 | 
			
		||||
      ->setLabel(t('Date and time'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setRequired(TRUE)
 | 
			
		||||
      // Uses the currentDateTime function from the Activity entity
 | 
			
		||||
      ->setDefaultValueCallback('\Drupal\opencase_entities\Entity\OCActivity::currentDateTime')
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'datetime_default',
 | 
			
		||||
        'settings' => [
 | 
			
		||||
          'format_type' => 'medium',
 | 
			
		||||
        ],
 | 
			
		||||
        'weight' => -3,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'datetime_default',
 | 
			
		||||
        'weight' => -3,
 | 
			
		||||
      ]);
 | 
			
		||||
 | 
			
		||||
    $fields['description'] = BaseFieldDefinition::create('string_long')
 | 
			
		||||
      ->setLabel(t('Description'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSettings([
 | 
			
		||||
        'max_length' => 50,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDefaultValue('')
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'basic_string',
 | 
			
		||||
        'weight' => -1,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'string_textarea',
 | 
			
		||||
        'weight' => -1,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setRequired(FALSE);
 | 
			
		||||
 | 
			
		||||
    $fields['attendees'] = BaseFieldDefinition::create('entity_reference')
 | 
			
		||||
      ->setLabel(t('Attendees'))
 | 
			
		||||
      ->setDescription(t('People attending this event.'))
 | 
			
		||||
      ->setSetting('target_type', 'oc_actor')
 | 
			
		||||
      ->setSetting('handler', 'default')
 | 
			
		||||
      ->setTranslatable(TRUE)
 | 
			
		||||
      ->setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED)
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => 50,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'entity_reference_autocomplete_tags',
 | 
			
		||||
        'weight' => 50,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setRequired(FALSE);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    return $fields;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										58
									
								
								modules/opencase_entities/src/Entity/OCEventInterface.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								modules/opencase_entities/src/Entity/OCEventInterface.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,58 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\ContentEntityInterface;
 | 
			
		||||
use Drupal\Core\Entity\EntityChangedInterface;
 | 
			
		||||
use Drupal\Core\Entity\EntityPublishedInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provides an interface for defining Event entities.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 */
 | 
			
		||||
interface OCEventInterface extends ContentEntityInterface, EntityChangedInterface, EntityPublishedInterface {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Add get/set methods for your configuration properties here.
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Gets the Event name.
 | 
			
		||||
   *
 | 
			
		||||
   * @return string
 | 
			
		||||
   *   Name of the Event.
 | 
			
		||||
   */
 | 
			
		||||
  public function getName();
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Sets the Event name.
 | 
			
		||||
   *
 | 
			
		||||
   * @param string $name
 | 
			
		||||
   *   The Event name.
 | 
			
		||||
   *
 | 
			
		||||
   * @return \Drupal\opencase_entities\Entity\OCEventInterface
 | 
			
		||||
   *   The called Event entity.
 | 
			
		||||
   */
 | 
			
		||||
  public function setName($name);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Gets the Event creation timestamp.
 | 
			
		||||
   *
 | 
			
		||||
   * @return int
 | 
			
		||||
   *   Creation timestamp of the Event.
 | 
			
		||||
   */
 | 
			
		||||
  public function getCreatedTime();
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Sets the Event creation timestamp.
 | 
			
		||||
   *
 | 
			
		||||
   * @param int $timestamp
 | 
			
		||||
   *   The Event creation timestamp.
 | 
			
		||||
   *
 | 
			
		||||
   * @return \Drupal\opencase_entities\Entity\OCEventInterface
 | 
			
		||||
   *   The called Event entity.
 | 
			
		||||
   */
 | 
			
		||||
  public function setCreatedTime($timestamp);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										58
									
								
								modules/opencase_entities/src/Entity/OCEventType.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								modules/opencase_entities/src/Entity/OCEventType.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,58 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Defines the Event type entity.
 | 
			
		||||
 *
 | 
			
		||||
 * @ConfigEntityType(
 | 
			
		||||
 *   id = "oc_event_type",
 | 
			
		||||
 *   label = @Translation("Event type"),
 | 
			
		||||
 *   handlers = {
 | 
			
		||||
 *     "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
 | 
			
		||||
 *     "list_builder" = "Drupal\opencase_entities\OCEventTypeListBuilder",
 | 
			
		||||
 *     "form" = {
 | 
			
		||||
 *       "add" = "Drupal\opencase_entities\Form\OCEventTypeForm",
 | 
			
		||||
 *       "edit" = "Drupal\opencase_entities\Form\OCEventTypeForm",
 | 
			
		||||
 *       "delete" = "Drupal\opencase_entities\Form\OCEventTypeDeleteForm"
 | 
			
		||||
 *     },
 | 
			
		||||
 *     "route_provider" = {
 | 
			
		||||
 *       "html" = "Drupal\opencase_entities\OCEventTypeHtmlRouteProvider",
 | 
			
		||||
 *     },
 | 
			
		||||
 *   },
 | 
			
		||||
 *   config_prefix = "oc_event_type",
 | 
			
		||||
 *   admin_permission = "administer site configuration",
 | 
			
		||||
 *   bundle_of = "oc_event",
 | 
			
		||||
 *   entity_keys = {
 | 
			
		||||
 *     "id" = "id",
 | 
			
		||||
 *     "label" = "label",
 | 
			
		||||
 *     "uuid" = "uuid"
 | 
			
		||||
 *   },
 | 
			
		||||
 *   links = {
 | 
			
		||||
 *     "canonical" = "/admin/opencase/oc_event_type/{oc_event_type}",
 | 
			
		||||
 *     "add-form" = "/admin/opencase/oc_event_type/add",
 | 
			
		||||
 *     "edit-form" = "/admin/opencase/oc_event_type/{oc_event_type}/edit",
 | 
			
		||||
 *     "delete-form" = "/admin/opencase/oc_event_type/{oc_event_type}/delete",
 | 
			
		||||
 *     "collection" = "/admin/opencase/oc_event_type"
 | 
			
		||||
 *   }
 | 
			
		||||
 * )
 | 
			
		||||
 */
 | 
			
		||||
class OCEventType extends ConfigEntityBundleBase implements OCEventTypeInterface {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The Event type ID.
 | 
			
		||||
   *
 | 
			
		||||
   * @var string
 | 
			
		||||
   */
 | 
			
		||||
  protected $id;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The Event type label.
 | 
			
		||||
   *
 | 
			
		||||
   * @var string
 | 
			
		||||
   */
 | 
			
		||||
  protected $label;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,13 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Config\Entity\ConfigEntityInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provides an interface for defining Event type entities.
 | 
			
		||||
 */
 | 
			
		||||
interface OCEventTypeInterface extends ConfigEntityInterface {
 | 
			
		||||
 | 
			
		||||
  // Add get/set methods for your configuration properties here.
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										23
									
								
								modules/opencase_entities/src/Entity/OCEventViewsData.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								modules/opencase_entities/src/Entity/OCEventViewsData.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,23 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\views\EntityViewsData;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provides Views data for Event entities.
 | 
			
		||||
 */
 | 
			
		||||
class OCEventViewsData extends EntityViewsData {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getViewsData() {
 | 
			
		||||
    $data = parent::getViewsData();
 | 
			
		||||
 | 
			
		||||
    // Additional information for Views integration, such as table joins, can be
 | 
			
		||||
    // put here.
 | 
			
		||||
    return $data;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										462
									
								
								modules/opencase_entities/src/Entity/OCOrganisation.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										462
									
								
								modules/opencase_entities/src/Entity/OCOrganisation.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,462 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\EntityStorageInterface;
 | 
			
		||||
use Drupal\Core\Field\BaseFieldDefinition;
 | 
			
		||||
use Drupal\Core\Entity\EditorialContentEntityBase;
 | 
			
		||||
use Drupal\Core\Entity\RevisionableInterface;
 | 
			
		||||
use Drupal\Core\Entity\EntityChangedTrait;
 | 
			
		||||
use Drupal\Core\Entity\EntityPublishedTrait;
 | 
			
		||||
use Drupal\Core\Entity\EntityTypeInterface;
 | 
			
		||||
use Drupal\user\UserInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Defines the Organisation entity.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 *
 | 
			
		||||
 * @ContentEntityType(
 | 
			
		||||
 *   id = "oc_organisation",
 | 
			
		||||
 *   label = @Translation("Organisation"),
 | 
			
		||||
 *   bundle_label = @Translation("Organisation type"),
 | 
			
		||||
 *   handlers = {
 | 
			
		||||
 *     "storage" = "Drupal\opencase_entities\OCOrganisationStorage",
 | 
			
		||||
 *     "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
 | 
			
		||||
 *     "list_builder" = "Drupal\opencase_entities\OCOrganisationListBuilder",
 | 
			
		||||
 *     "views_data" = "Drupal\opencase_entities\Entity\OCOrganisationViewsData",
 | 
			
		||||
 *     "translation" = "Drupal\opencase_entities\OCOrganisationTranslationHandler",
 | 
			
		||||
 *
 | 
			
		||||
 *     "form" = {
 | 
			
		||||
 *       "default" = "Drupal\opencase_entities\Form\OCOrganisationForm",
 | 
			
		||||
 *       "add" = "Drupal\opencase_entities\Form\OCOrganisationForm",
 | 
			
		||||
 *       "edit" = "Drupal\opencase_entities\Form\OCOrganisationForm",
 | 
			
		||||
 *       "delete" = "Drupal\opencase_entities\Form\OCOrganisationDeleteForm",
 | 
			
		||||
 *     },
 | 
			
		||||
 *     "route_provider" = {
 | 
			
		||||
 *       "html" = "Drupal\opencase_entities\OCOrganisationHtmlRouteProvider",
 | 
			
		||||
 *     },
 | 
			
		||||
 *     "access" = "Drupal\opencase_entities\OCOrganisationAccessControlHandler",
 | 
			
		||||
 *   },
 | 
			
		||||
 *   base_table = "oc_organisation",
 | 
			
		||||
 *   data_table = "oc_organisation_field_data",
 | 
			
		||||
 *   revision_table = "oc_organisation_revision",
 | 
			
		||||
 *   revision_data_table = "oc_organisation_field_revision",
 | 
			
		||||
 *   translatable = TRUE,
 | 
			
		||||
 *   permission_granularity = "bundle",
 | 
			
		||||
 *   admin_permission = "administer organisation entities",
 | 
			
		||||
 *   entity_keys = {
 | 
			
		||||
 *     "id" = "id",
 | 
			
		||||
 *     "revision" = "vid",
 | 
			
		||||
 *     "bundle" = "type",
 | 
			
		||||
 *     "label" = "name",
 | 
			
		||||
 *     "uuid" = "uuid",
 | 
			
		||||
 *     "uid" = "user_id",
 | 
			
		||||
 *     "langcode" = "langcode",
 | 
			
		||||
 *     "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",
 | 
			
		||||
 *   },
 | 
			
		||||
 *   bundle_entity_type = "oc_organisation_type",
 | 
			
		||||
 *   field_ui_base_route = "entity.oc_organisation_type.edit_form"
 | 
			
		||||
 * )
 | 
			
		||||
 */
 | 
			
		||||
class OCOrganisation extends EditorialContentEntityBase implements OCOrganisationInterface {
 | 
			
		||||
 | 
			
		||||
  use EntityChangedTrait;
 | 
			
		||||
  use EntityPublishedTrait;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
 | 
			
		||||
    parent::preCreate($storage_controller, $values);
 | 
			
		||||
    $values += [
 | 
			
		||||
      'user_id' => \Drupal::currentUser()->id(),
 | 
			
		||||
    ];
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  protected function urlRouteParameters($rel) {
 | 
			
		||||
    $uri_route_parameters = parent::urlRouteParameters($rel);
 | 
			
		||||
 | 
			
		||||
    if ($rel === 'revision_revert' && $this instanceof RevisionableInterface) {
 | 
			
		||||
      $uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId();
 | 
			
		||||
    }
 | 
			
		||||
    elseif ($rel === 'revision_delete' && $this instanceof RevisionableInterface) {
 | 
			
		||||
      $uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return $uri_route_parameters;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function preSave(EntityStorageInterface $storage) {
 | 
			
		||||
    parent::preSave($storage);
 | 
			
		||||
 | 
			
		||||
    foreach (array_keys($this->getTranslationLanguages()) as $langcode) {
 | 
			
		||||
      $translation = $this->getTranslation($langcode);
 | 
			
		||||
 | 
			
		||||
      // If no owner has been set explicitly, make the anonymous user the owner.
 | 
			
		||||
      if (!$translation->getOwner()) {
 | 
			
		||||
        $translation->setOwnerId(0);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // If no revision author has been set explicitly,
 | 
			
		||||
    // make the oc_organisation owner the revision author.
 | 
			
		||||
    if (!$this->getRevisionUser()) {
 | 
			
		||||
      $this->setRevisionUserId($this->getOwnerId());
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getName() {
 | 
			
		||||
    return $this->get('name')->value;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function setName($name) {
 | 
			
		||||
    $this->set('name', $name);
 | 
			
		||||
    return $this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getCreatedTime() {
 | 
			
		||||
    return $this->get('created')->value;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function setCreatedTime($timestamp) {
 | 
			
		||||
    $this->set('created', $timestamp);
 | 
			
		||||
    return $this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getOwner() {
 | 
			
		||||
    return $this->get('user_id')->entity;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getOwnerId() {
 | 
			
		||||
    return $this->get('user_id')->target_id;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function setOwnerId($uid) {
 | 
			
		||||
    $this->set('user_id', $uid);
 | 
			
		||||
    return $this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function setOwner(UserInterface $account) {
 | 
			
		||||
    $this->set('user_id', $account->id());
 | 
			
		||||
    return $this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
 | 
			
		||||
    $fields = parent::baseFieldDefinitions($entity_type);
 | 
			
		||||
 | 
			
		||||
    // Add the published field.
 | 
			
		||||
    $fields += static::publishedBaseFieldDefinitions($entity_type);
 | 
			
		||||
 | 
			
		||||
    $fields['notes'] = BaseFieldDefinition::create('string_long')
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setLabel(t('Notes'))
 | 
			
		||||
      ->setSettings(array(
 | 
			
		||||
        'default_value' => '',
 | 
			
		||||
        'max_length' => 255,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('view', array(
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'basic_string',
 | 
			
		||||
        'weight' => 50,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('form', array(
 | 
			
		||||
        'type' => 'string_textarea',
 | 
			
		||||
        'weight' => 50,
 | 
			
		||||
      ));
 | 
			
		||||
    $fields['contact_name'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setLabel(t('Contact Name'))
 | 
			
		||||
      ->setDescription(t('Name of the main contact for this client.'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSettings([
 | 
			
		||||
        'max_length' => 50,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDefaultValue('')
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => 51,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => 51,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setRequired(FALSE);
 | 
			
		||||
 | 
			
		||||
    $fields['email'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setLabel(t('Email Address'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSettings(array(
 | 
			
		||||
        'default_value' => '',
 | 
			
		||||
        'max_length' => 30,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('view', array(
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => 52,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('form', array(
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => 52,
 | 
			
		||||
      ));
 | 
			
		||||
 | 
			
		||||
    $fields['phone'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setLabel(t('Phone Number'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSettings(array(
 | 
			
		||||
        'default_value' => '',
 | 
			
		||||
        'max_length' => 20,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('view', array(
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => 53,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('form', array(
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => 53,
 | 
			
		||||
      ));
 | 
			
		||||
    $fields['postal_address'] = BaseFieldDefinition::create('string_long')
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setLabel(t('Postal Address'))
 | 
			
		||||
      ->setDescription(t('Full address, apart from post code.'))
 | 
			
		||||
      ->setSettings(array(
 | 
			
		||||
        'default_value' => '',
 | 
			
		||||
        'max_length' => 255,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('view', array(
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'basic_string',
 | 
			
		||||
        'weight' => 54,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('form', array(
 | 
			
		||||
        'type' => 'string_textarea',
 | 
			
		||||
        'weight' => 54,
 | 
			
		||||
      ));
 | 
			
		||||
    $fields['post_code'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setLabel(t('Post Code'))
 | 
			
		||||
      ->setSettings(array(
 | 
			
		||||
        'default_value' => '',
 | 
			
		||||
        'max_length' => 10,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('view', array(
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => 55,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('form', array(
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => 55,
 | 
			
		||||
      ));
 | 
			
		||||
    $fields['billing_contact_name'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setLabel(t('Billing Contact Name'))
 | 
			
		||||
      ->setDescription(t('Name of the main contact for this client.'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSettings([
 | 
			
		||||
        'max_length' => 50,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDefaultValue('')
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => 56,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => 56,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setRequired(FALSE);
 | 
			
		||||
 | 
			
		||||
    $fields['billing_email'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setLabel(t('Billing Email Address'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSettings(array(
 | 
			
		||||
        'default_value' => '',
 | 
			
		||||
        'max_length' => 30,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('view', array(
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => 57,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('form', array(
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => 57,
 | 
			
		||||
      ));
 | 
			
		||||
 | 
			
		||||
    $fields['billing_phone'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setLabel(t('Billing Phone Number'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSettings(array(
 | 
			
		||||
        'default_value' => '',
 | 
			
		||||
        'max_length' => 20,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('view', array(
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => 58,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('form', array(
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => 58,
 | 
			
		||||
      ));
 | 
			
		||||
    $fields['billing_postal_address'] = BaseFieldDefinition::create('string_long')
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setLabel(t('Billing Postal Address'))
 | 
			
		||||
      ->setDescription(t('Full address, apart from post code.'))
 | 
			
		||||
      ->setSettings(array(
 | 
			
		||||
        'default_value' => '',
 | 
			
		||||
        'max_length' => 255,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('view', array(
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'basic_string',
 | 
			
		||||
        'weight' => 59,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('form', array(
 | 
			
		||||
        'type' => 'string_textarea',
 | 
			
		||||
        'weight' => 59,
 | 
			
		||||
      ));
 | 
			
		||||
    $fields['billing_post_code'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setLabel(t('Billing Post Code'))
 | 
			
		||||
      ->setSettings(array(
 | 
			
		||||
        'default_value' => '',
 | 
			
		||||
        'max_length' => 10,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('view', array(
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => 60,
 | 
			
		||||
      ))
 | 
			
		||||
      ->setDisplayOptions('form', array(
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => 60,
 | 
			
		||||
      ));
 | 
			
		||||
    $fields['user_id'] = BaseFieldDefinition::create('entity_reference')
 | 
			
		||||
      ->setLabel(t('Added by'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSetting('target_type', 'user')
 | 
			
		||||
      ->setSetting('handler', 'default')
 | 
			
		||||
      ->setTranslatable(TRUE);
 | 
			
		||||
 | 
			
		||||
    $fields['name'] = BaseFieldDefinition::create('string')
 | 
			
		||||
      ->setLabel(t('Name'))
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setSettings([
 | 
			
		||||
        'max_length' => 50,
 | 
			
		||||
        'text_processing' => 0,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDefaultValue('')
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'hidden',
 | 
			
		||||
        'type' => 'string',
 | 
			
		||||
        'weight' => -100,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'string_textfield',
 | 
			
		||||
        'weight' => -100,
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayConfigurable('form', TRUE)
 | 
			
		||||
      ->setDisplayConfigurable('view', TRUE)
 | 
			
		||||
      ->setRequired(TRUE);
 | 
			
		||||
 | 
			
		||||
    $fields['status']->setDescription(t('A boolean indicating whether the Organisation is published.'));
 | 
			
		||||
 | 
			
		||||
    $fields['created'] = BaseFieldDefinition::create('created')
 | 
			
		||||
      ->setLabel(t('Created'))
 | 
			
		||||
      ->setDescription(t('The time that the entity was created.'));
 | 
			
		||||
 | 
			
		||||
    $fields['changed'] = BaseFieldDefinition::create('changed')
 | 
			
		||||
      ->setLabel(t('Changed'))
 | 
			
		||||
      ->setDescription(t('The time that the entity was last edited.'));
 | 
			
		||||
 | 
			
		||||
    $fields['revision_translation_affected'] = BaseFieldDefinition::create('boolean')
 | 
			
		||||
      ->setLabel(t('Revision translation affected'))
 | 
			
		||||
      ->setDescription(t('Indicates if the last edit of a translation belongs to current revision.'))
 | 
			
		||||
      ->setReadOnly(TRUE)
 | 
			
		||||
      ->setRevisionable(TRUE)
 | 
			
		||||
      ->setTranslatable(TRUE);
 | 
			
		||||
 | 
			
		||||
    $fields['files'] = BaseFieldDefinition::create('file')
 | 
			
		||||
      ->setLabel(t('Files'))
 | 
			
		||||
      ->setDescription(t('Files relating to this organisation'))
 | 
			
		||||
      ->setSetting('file_directory', '[date:custom:Y]-[date:custom:m]')
 | 
			
		||||
      ->setSetting('handler', 'default:file')
 | 
			
		||||
      ->setSetting('file_extensions', 'txt jpg jpeg gif rtf xls xlsx doc swf png pdf docx csv')
 | 
			
		||||
      ->setSetting('description_field', 'true')
 | 
			
		||||
      ->setSetting('uri_scheme', 'private')
 | 
			
		||||
      ->setCardinality(-1)
 | 
			
		||||
      ->setDisplayOptions('form', [
 | 
			
		||||
        'type' => 'file_generic',
 | 
			
		||||
        'weight' => 61,
 | 
			
		||||
        'settings' => [
 | 
			
		||||
          'progress_indicator' => 'throbber',
 | 
			
		||||
        ],
 | 
			
		||||
      ])
 | 
			
		||||
      ->setDisplayOptions('view', [
 | 
			
		||||
        'label' => 'above',
 | 
			
		||||
        'settings' => ['use_description_as_link_text' => 'true']
 | 
			
		||||
      ]);
 | 
			
		||||
    return $fields;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,98 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\ContentEntityInterface;
 | 
			
		||||
use Drupal\Core\Entity\RevisionLogInterface;
 | 
			
		||||
use Drupal\Core\Entity\EntityChangedInterface;
 | 
			
		||||
use Drupal\Core\Entity\EntityPublishedInterface;
 | 
			
		||||
use Drupal\user\EntityOwnerInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provides an interface for defining Organisation entities.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 */
 | 
			
		||||
interface OCOrganisationInterface extends ContentEntityInterface, RevisionLogInterface, EntityChangedInterface, EntityPublishedInterface, EntityOwnerInterface {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Add get/set methods for your configuration properties here.
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Gets the Organisation name.
 | 
			
		||||
   *
 | 
			
		||||
   * @return string
 | 
			
		||||
   *   Name of the Organisation.
 | 
			
		||||
   */
 | 
			
		||||
  public function getName();
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Sets the Organisation name.
 | 
			
		||||
   *
 | 
			
		||||
   * @param string $name
 | 
			
		||||
   *   The Organisation name.
 | 
			
		||||
   *
 | 
			
		||||
   * @return \Drupal\opencase_entities\Entity\OCOrganisationInterface
 | 
			
		||||
   *   The called Organisation entity.
 | 
			
		||||
   */
 | 
			
		||||
  public function setName($name);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Gets the Organisation creation timestamp.
 | 
			
		||||
   *
 | 
			
		||||
   * @return int
 | 
			
		||||
   *   Creation timestamp of the Organisation.
 | 
			
		||||
   */
 | 
			
		||||
  public function getCreatedTime();
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Sets the Organisation creation timestamp.
 | 
			
		||||
   *
 | 
			
		||||
   * @param int $timestamp
 | 
			
		||||
   *   The Organisation creation timestamp.
 | 
			
		||||
   *
 | 
			
		||||
   * @return \Drupal\opencase_entities\Entity\OCOrganisationInterface
 | 
			
		||||
   *   The called Organisation entity.
 | 
			
		||||
   */
 | 
			
		||||
  public function setCreatedTime($timestamp);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Gets the Organisation revision creation timestamp.
 | 
			
		||||
   *
 | 
			
		||||
   * @return int
 | 
			
		||||
   *   The UNIX timestamp of when this revision was created.
 | 
			
		||||
   */
 | 
			
		||||
  public function getRevisionCreationTime();
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Sets the Organisation revision creation timestamp.
 | 
			
		||||
   *
 | 
			
		||||
   * @param int $timestamp
 | 
			
		||||
   *   The UNIX timestamp of when this revision was created.
 | 
			
		||||
   *
 | 
			
		||||
   * @return \Drupal\opencase_entities\Entity\OCOrganisationInterface
 | 
			
		||||
   *   The called Organisation entity.
 | 
			
		||||
   */
 | 
			
		||||
  public function setRevisionCreationTime($timestamp);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Gets the Organisation revision author.
 | 
			
		||||
   *
 | 
			
		||||
   * @return \Drupal\user\UserInterface
 | 
			
		||||
   *   The user entity for the revision author.
 | 
			
		||||
   */
 | 
			
		||||
  public function getRevisionUser();
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Sets the Organisation revision author.
 | 
			
		||||
   *
 | 
			
		||||
   * @param int $uid
 | 
			
		||||
   *   The user ID of the revision author.
 | 
			
		||||
   *
 | 
			
		||||
   * @return \Drupal\opencase_entities\Entity\OCOrganisationInterface
 | 
			
		||||
   *   The called Organisation entity.
 | 
			
		||||
   */
 | 
			
		||||
  public function setRevisionUserId($uid);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										58
									
								
								modules/opencase_entities/src/Entity/OCOrganisationType.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								modules/opencase_entities/src/Entity/OCOrganisationType.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,58 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Defines the Organisation type entity.
 | 
			
		||||
 *
 | 
			
		||||
 * @ConfigEntityType(
 | 
			
		||||
 *   id = "oc_organisation_type",
 | 
			
		||||
 *   label = @Translation("Organisation type"),
 | 
			
		||||
 *   handlers = {
 | 
			
		||||
 *     "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
 | 
			
		||||
 *     "list_builder" = "Drupal\opencase_entities\OCOrganisationTypeListBuilder",
 | 
			
		||||
 *     "form" = {
 | 
			
		||||
 *       "add" = "Drupal\opencase_entities\Form\OCOrganisationTypeForm",
 | 
			
		||||
 *       "edit" = "Drupal\opencase_entities\Form\OCOrganisationTypeForm",
 | 
			
		||||
 *       "delete" = "Drupal\opencase_entities\Form\OCOrganisationTypeDeleteForm"
 | 
			
		||||
 *     },
 | 
			
		||||
 *     "route_provider" = {
 | 
			
		||||
 *       "html" = "Drupal\opencase_entities\OCOrganisationTypeHtmlRouteProvider",
 | 
			
		||||
 *     },
 | 
			
		||||
 *   },
 | 
			
		||||
 *   config_prefix = "oc_organisation_type",
 | 
			
		||||
 *   admin_permission = "administer site configuration",
 | 
			
		||||
 *   bundle_of = "oc_organisation",
 | 
			
		||||
 *   entity_keys = {
 | 
			
		||||
 *     "id" = "id",
 | 
			
		||||
 *     "label" = "label",
 | 
			
		||||
 *     "uuid" = "uuid"
 | 
			
		||||
 *   },
 | 
			
		||||
 *   links = {
 | 
			
		||||
 *     "canonical" = "/admin/opencase/oc_organisation_type/{oc_organisation_type}",
 | 
			
		||||
 *     "add-form" = "/admin/opencase/oc_organisation_type/add",
 | 
			
		||||
 *     "edit-form" = "/admin/opencase/oc_organisation_type/{oc_organisation_type}/edit",
 | 
			
		||||
 *     "delete-form" = "/admin/opencase/oc_organisation_type/{oc_organisation_type}/delete",
 | 
			
		||||
 *     "collection" = "/admin/opencase/oc_organisation_type"
 | 
			
		||||
 *   }
 | 
			
		||||
 * )
 | 
			
		||||
 */
 | 
			
		||||
class OCOrganisationType extends ConfigEntityBundleBase implements OCOrganisationTypeInterface {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The Organisation type ID.
 | 
			
		||||
   *
 | 
			
		||||
   * @var string
 | 
			
		||||
   */
 | 
			
		||||
  protected $id;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The Organisation type label.
 | 
			
		||||
   *
 | 
			
		||||
   * @var string
 | 
			
		||||
   */
 | 
			
		||||
  protected $label;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,13 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Config\Entity\ConfigEntityInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provides an interface for defining Organisation type entities.
 | 
			
		||||
 */
 | 
			
		||||
interface OCOrganisationTypeInterface extends ConfigEntityInterface {
 | 
			
		||||
 | 
			
		||||
  // Add get/set methods for your configuration properties here.
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,23 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Entity;
 | 
			
		||||
 | 
			
		||||
use Drupal\views\EntityViewsData;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provides Views data for Organisation entities.
 | 
			
		||||
 */
 | 
			
		||||
class OCOrganisationViewsData extends EntityViewsData {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getViewsData() {
 | 
			
		||||
    $data = parent::getViewsData();
 | 
			
		||||
 | 
			
		||||
    // Additional information for Views integration, such as table joins, can be
 | 
			
		||||
    // put here.
 | 
			
		||||
    return $data;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -38,18 +38,11 @@ class OCActorForm extends ContentEntityForm {
 | 
			
		||||
   */
 | 
			
		||||
  public function save(array $form, FormStateInterface $form_state) {
 | 
			
		||||
    $entity = $this->entity;
 | 
			
		||||
 | 
			
		||||
    // Save as a new revision if requested to do so.
 | 
			
		||||
    if (!$form_state->isValueEmpty('new_revision') && $form_state->getValue('new_revision') != FALSE) {
 | 
			
		||||
      $entity->setNewRevision();
 | 
			
		||||
 | 
			
		||||
      // If a new revision is created, save the current user as revision author.
 | 
			
		||||
      $entity->setRevisionCreationTime(REQUEST_TIME);
 | 
			
		||||
      $entity->setRevisionUserId(\Drupal::currentUser()->id());
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
      $entity->setNewRevision(FALSE);
 | 
			
		||||
    }
 | 
			
		||||
    // Always make a new revision for a person. They are not changed often and people are likely to
 | 
			
		||||
    // want to know what has happened to them over time.
 | 
			
		||||
    $entity->setNewRevision();
 | 
			
		||||
    $entity->setRevisionCreationTime(REQUEST_TIME);
 | 
			
		||||
    $entity->setRevisionUserId(\Drupal::currentUser()->id());
 | 
			
		||||
 | 
			
		||||
    $status = parent::save($form, $form_state);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,15 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\ContentEntityDeleteForm;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provides a form for deleting Bank Account entities.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 */
 | 
			
		||||
class OCBankAccountDeleteForm extends ContentEntityDeleteForm {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										66
									
								
								modules/opencase_entities/src/Form/OCBankAccountForm.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								modules/opencase_entities/src/Form/OCBankAccountForm.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,66 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\ContentEntityForm;
 | 
			
		||||
use Drupal\Core\Form\FormStateInterface;
 | 
			
		||||
use Symfony\Component\DependencyInjection\ContainerInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Form controller for Bank Account edit forms.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 */
 | 
			
		||||
class OCBankAccountForm extends ContentEntityForm {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The current user account.
 | 
			
		||||
   *
 | 
			
		||||
   * @var \Drupal\Core\Session\AccountProxyInterface
 | 
			
		||||
   */
 | 
			
		||||
  protected $account;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public static function create(ContainerInterface $container) {
 | 
			
		||||
    // Instantiates this form class.
 | 
			
		||||
    $instance = parent::create($container);
 | 
			
		||||
    $instance->account = $container->get('current_user');
 | 
			
		||||
    return $instance;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function buildForm(array $form, FormStateInterface $form_state) {
 | 
			
		||||
    /* @var \Drupal\opencase_entities\Entity\OCBankAccount $entity */
 | 
			
		||||
    $form = parent::buildForm($form, $form_state);
 | 
			
		||||
 | 
			
		||||
    return $form;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function save(array $form, FormStateInterface $form_state) {
 | 
			
		||||
    $entity = $this->entity;
 | 
			
		||||
 | 
			
		||||
    $status = parent::save($form, $form_state);
 | 
			
		||||
 | 
			
		||||
    switch ($status) {
 | 
			
		||||
      case SAVED_NEW:
 | 
			
		||||
        $this->messenger()->addMessage($this->t('Created the %label Bank Account.', [
 | 
			
		||||
          '%label' => $entity->label(),
 | 
			
		||||
        ]));
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
      default:
 | 
			
		||||
        $this->messenger()->addMessage($this->t('Saved the %label Bank Account.', [
 | 
			
		||||
          '%label' => $entity->label(),
 | 
			
		||||
        ]));
 | 
			
		||||
    }
 | 
			
		||||
    $form_state->setRedirect('entity.oc_bank_account.canonical', ['oc_bank_account' => $entity->id()]);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,53 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Form\FormBase;
 | 
			
		||||
use Drupal\Core\Form\FormStateInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class OCBankAccountSettingsForm.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 */
 | 
			
		||||
class OCBankAccountSettingsForm extends FormBase {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Returns a unique string identifying the form.
 | 
			
		||||
   *
 | 
			
		||||
   * @return string
 | 
			
		||||
   *   The unique string identifying the form.
 | 
			
		||||
   */
 | 
			
		||||
  public function getFormId() {
 | 
			
		||||
    return 'ocbankaccount_settings';
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Form submission handler.
 | 
			
		||||
   *
 | 
			
		||||
   * @param array $form
 | 
			
		||||
   *   An associative array containing the structure of the form.
 | 
			
		||||
   * @param \Drupal\Core\Form\FormStateInterface $form_state
 | 
			
		||||
   *   The current state of the form.
 | 
			
		||||
   */
 | 
			
		||||
  public function submitForm(array &$form, FormStateInterface $form_state) {
 | 
			
		||||
    // Empty implementation of the abstract submit class.
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Defines the settings form for Bank Account entities.
 | 
			
		||||
   *
 | 
			
		||||
   * @param array $form
 | 
			
		||||
   *   An associative array containing the structure of the form.
 | 
			
		||||
   * @param \Drupal\Core\Form\FormStateInterface $form_state
 | 
			
		||||
   *   The current state of the form.
 | 
			
		||||
   *
 | 
			
		||||
   * @return array
 | 
			
		||||
   *   Form definition array.
 | 
			
		||||
   */
 | 
			
		||||
  public function buildForm(array $form, FormStateInterface $form_state) {
 | 
			
		||||
    $form['ocbankaccount_settings']['#markup'] = 'Settings form for Bank Account entities. Manage field settings here.';
 | 
			
		||||
    return $form;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										15
									
								
								modules/opencase_entities/src/Form/OCEventDeleteForm.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								modules/opencase_entities/src/Form/OCEventDeleteForm.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,15 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\ContentEntityDeleteForm;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provides a form for deleting Event entities.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 */
 | 
			
		||||
class OCEventDeleteForm extends ContentEntityDeleteForm {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										66
									
								
								modules/opencase_entities/src/Form/OCEventForm.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								modules/opencase_entities/src/Form/OCEventForm.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,66 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\ContentEntityForm;
 | 
			
		||||
use Drupal\Core\Form\FormStateInterface;
 | 
			
		||||
use Symfony\Component\DependencyInjection\ContainerInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Form controller for Event edit forms.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 */
 | 
			
		||||
class OCEventForm extends ContentEntityForm {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The current user account.
 | 
			
		||||
   *
 | 
			
		||||
   * @var \Drupal\Core\Session\AccountProxyInterface
 | 
			
		||||
   */
 | 
			
		||||
  protected $account;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public static function create(ContainerInterface $container) {
 | 
			
		||||
    // Instantiates this form class.
 | 
			
		||||
    $instance = parent::create($container);
 | 
			
		||||
    $instance->account = $container->get('current_user');
 | 
			
		||||
    return $instance;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function buildForm(array $form, FormStateInterface $form_state) {
 | 
			
		||||
    /* @var \Drupal\opencase_entities\Entity\OCEvent $entity */
 | 
			
		||||
    $form = parent::buildForm($form, $form_state);
 | 
			
		||||
 | 
			
		||||
    return $form;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function save(array $form, FormStateInterface $form_state) {
 | 
			
		||||
    $entity = $this->entity;
 | 
			
		||||
 | 
			
		||||
    $status = parent::save($form, $form_state);
 | 
			
		||||
 | 
			
		||||
    switch ($status) {
 | 
			
		||||
      case SAVED_NEW:
 | 
			
		||||
        $this->messenger()->addMessage($this->t('Created the %label Event.', [
 | 
			
		||||
          '%label' => $entity->label(),
 | 
			
		||||
        ]));
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
      default:
 | 
			
		||||
        $this->messenger()->addMessage($this->t('Saved the %label Event.', [
 | 
			
		||||
          '%label' => $entity->label(),
 | 
			
		||||
        ]));
 | 
			
		||||
    }
 | 
			
		||||
    $form_state->setRedirect('entity.oc_event.canonical', ['oc_event' => $entity->id()]);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										53
									
								
								modules/opencase_entities/src/Form/OCEventSettingsForm.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								modules/opencase_entities/src/Form/OCEventSettingsForm.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,53 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Form\FormBase;
 | 
			
		||||
use Drupal\Core\Form\FormStateInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class OCEventSettingsForm.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 */
 | 
			
		||||
class OCEventSettingsForm extends FormBase {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Returns a unique string identifying the form.
 | 
			
		||||
   *
 | 
			
		||||
   * @return string
 | 
			
		||||
   *   The unique string identifying the form.
 | 
			
		||||
   */
 | 
			
		||||
  public function getFormId() {
 | 
			
		||||
    return 'ocevent_settings';
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Form submission handler.
 | 
			
		||||
   *
 | 
			
		||||
   * @param array $form
 | 
			
		||||
   *   An associative array containing the structure of the form.
 | 
			
		||||
   * @param \Drupal\Core\Form\FormStateInterface $form_state
 | 
			
		||||
   *   The current state of the form.
 | 
			
		||||
   */
 | 
			
		||||
  public function submitForm(array &$form, FormStateInterface $form_state) {
 | 
			
		||||
    // Empty implementation of the abstract submit class.
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Defines the settings form for Event entities.
 | 
			
		||||
   *
 | 
			
		||||
   * @param array $form
 | 
			
		||||
   *   An associative array containing the structure of the form.
 | 
			
		||||
   * @param \Drupal\Core\Form\FormStateInterface $form_state
 | 
			
		||||
   *   The current state of the form.
 | 
			
		||||
   *
 | 
			
		||||
   * @return array
 | 
			
		||||
   *   Form definition array.
 | 
			
		||||
   */
 | 
			
		||||
  public function buildForm(array $form, FormStateInterface $form_state) {
 | 
			
		||||
    $form['ocevent_settings']['#markup'] = 'Settings form for Event entities. Manage field settings here.';
 | 
			
		||||
    return $form;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										51
									
								
								modules/opencase_entities/src/Form/OCEventTypeDeleteForm.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								modules/opencase_entities/src/Form/OCEventTypeDeleteForm.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,51 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\EntityConfirmFormBase;
 | 
			
		||||
use Drupal\Core\Form\FormStateInterface;
 | 
			
		||||
use Drupal\Core\Url;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Builds the form to delete Event type entities.
 | 
			
		||||
 */
 | 
			
		||||
class OCEventTypeDeleteForm extends EntityConfirmFormBase {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getQuestion() {
 | 
			
		||||
    return $this->t('Are you sure you want to delete %name?', ['%name' => $this->entity->label()]);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getCancelUrl() {
 | 
			
		||||
    return new Url('entity.oc_event_type.collection');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getConfirmText() {
 | 
			
		||||
    return $this->t('Delete');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function submitForm(array &$form, FormStateInterface $form_state) {
 | 
			
		||||
    $this->entity->delete();
 | 
			
		||||
 | 
			
		||||
    $this->messenger()->addMessage(
 | 
			
		||||
      $this->t('content @type: deleted @label.', [
 | 
			
		||||
        '@type' => $this->entity->bundle(),
 | 
			
		||||
        '@label' => $this->entity->label(),
 | 
			
		||||
      ])
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    $form_state->setRedirectUrl($this->getCancelUrl());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										65
									
								
								modules/opencase_entities/src/Form/OCEventTypeForm.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								modules/opencase_entities/src/Form/OCEventTypeForm.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,65 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\EntityForm;
 | 
			
		||||
use Drupal\Core\Form\FormStateInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class OCEventTypeForm.
 | 
			
		||||
 */
 | 
			
		||||
class OCEventTypeForm extends EntityForm {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function form(array $form, FormStateInterface $form_state) {
 | 
			
		||||
    $form = parent::form($form, $form_state);
 | 
			
		||||
 | 
			
		||||
    $oc_event_type = $this->entity;
 | 
			
		||||
    $form['label'] = [
 | 
			
		||||
      '#type' => 'textfield',
 | 
			
		||||
      '#title' => $this->t('Label'),
 | 
			
		||||
      '#maxlength' => 255,
 | 
			
		||||
      '#default_value' => $oc_event_type->label(),
 | 
			
		||||
      '#description' => $this->t("Label for the Event type."),
 | 
			
		||||
      '#required' => TRUE,
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    $form['id'] = [
 | 
			
		||||
      '#type' => 'machine_name',
 | 
			
		||||
      '#default_value' => $oc_event_type->id(),
 | 
			
		||||
      '#machine_name' => [
 | 
			
		||||
        'exists' => '\Drupal\opencase_entities\Entity\OCEventType::load',
 | 
			
		||||
      ],
 | 
			
		||||
      '#disabled' => !$oc_event_type->isNew(),
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    /* You will need additional form elements for your custom properties. */
 | 
			
		||||
 | 
			
		||||
    return $form;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function save(array $form, FormStateInterface $form_state) {
 | 
			
		||||
    $oc_event_type = $this->entity;
 | 
			
		||||
    $status = $oc_event_type->save();
 | 
			
		||||
 | 
			
		||||
    switch ($status) {
 | 
			
		||||
      case SAVED_NEW:
 | 
			
		||||
        $this->messenger()->addMessage($this->t('Created the %label Event type.', [
 | 
			
		||||
          '%label' => $oc_event_type->label(),
 | 
			
		||||
        ]));
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
      default:
 | 
			
		||||
        $this->messenger()->addMessage($this->t('Saved the %label Event type.', [
 | 
			
		||||
          '%label' => $oc_event_type->label(),
 | 
			
		||||
        ]));
 | 
			
		||||
    }
 | 
			
		||||
    $form_state->setRedirectUrl($oc_event_type->toUrl('collection'));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,15 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\ContentEntityDeleteForm;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provides a form for deleting Organisation entities.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 */
 | 
			
		||||
class OCOrganisationDeleteForm extends ContentEntityDeleteForm {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										87
									
								
								modules/opencase_entities/src/Form/OCOrganisationForm.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								modules/opencase_entities/src/Form/OCOrganisationForm.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,87 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Entity\ContentEntityForm;
 | 
			
		||||
use Drupal\Core\Form\FormStateInterface;
 | 
			
		||||
use Symfony\Component\DependencyInjection\ContainerInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Form controller for Organisation edit forms.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 */
 | 
			
		||||
class OCOrganisationForm extends ContentEntityForm {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The current user account.
 | 
			
		||||
   *
 | 
			
		||||
   * @var \Drupal\Core\Session\AccountProxyInterface
 | 
			
		||||
   */
 | 
			
		||||
  protected $account;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public static function create(ContainerInterface $container) {
 | 
			
		||||
    // Instantiates this form class.
 | 
			
		||||
    $instance = parent::create($container);
 | 
			
		||||
    $instance->account = $container->get('current_user');
 | 
			
		||||
    return $instance;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function buildForm(array $form, FormStateInterface $form_state) {
 | 
			
		||||
    /* @var \Drupal\opencase_entities\Entity\OCOrganisation $entity */
 | 
			
		||||
    $form = parent::buildForm($form, $form_state);
 | 
			
		||||
 | 
			
		||||
    if (!$this->entity->isNew()) {
 | 
			
		||||
      $form['new_revision'] = [
 | 
			
		||||
        '#type' => 'checkbox',
 | 
			
		||||
        '#title' => $this->t('Create new revision'),
 | 
			
		||||
        '#default_value' => FALSE,
 | 
			
		||||
        '#weight' => 10,
 | 
			
		||||
      ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return $form;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function save(array $form, FormStateInterface $form_state) {
 | 
			
		||||
    $entity = $this->entity;
 | 
			
		||||
 | 
			
		||||
    // Save as a new revision if requested to do so.
 | 
			
		||||
    if (!$form_state->isValueEmpty('new_revision') && $form_state->getValue('new_revision') != FALSE) {
 | 
			
		||||
      $entity->setNewRevision();
 | 
			
		||||
 | 
			
		||||
      // If a new revision is created, save the current user as revision author.
 | 
			
		||||
      $entity->setRevisionCreationTime($this->time->getRequestTime());
 | 
			
		||||
      $entity->setRevisionUserId($this->account->id());
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
      $entity->setNewRevision(FALSE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $status = parent::save($form, $form_state);
 | 
			
		||||
 | 
			
		||||
    switch ($status) {
 | 
			
		||||
      case SAVED_NEW:
 | 
			
		||||
        $this->messenger()->addMessage($this->t('Created the %label Organisation.', [
 | 
			
		||||
          '%label' => $entity->label(),
 | 
			
		||||
        ]));
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
      default:
 | 
			
		||||
        $this->messenger()->addMessage($this->t('Saved the %label Organisation.', [
 | 
			
		||||
          '%label' => $entity->label(),
 | 
			
		||||
        ]));
 | 
			
		||||
    }
 | 
			
		||||
    $form_state->setRedirect('entity.oc_organisation.canonical', ['oc_organisation' => $entity->id()]);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,108 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\opencase_entities\Form;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Form\ConfirmFormBase;
 | 
			
		||||
use Drupal\Core\Form\FormStateInterface;
 | 
			
		||||
use Drupal\Core\Url;
 | 
			
		||||
use Symfony\Component\DependencyInjection\ContainerInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provides a form for deleting a Organisation revision.
 | 
			
		||||
 *
 | 
			
		||||
 * @ingroup opencase_entities
 | 
			
		||||
 */
 | 
			
		||||
class OCOrganisationRevisionDeleteForm extends ConfirmFormBase {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The Organisation revision.
 | 
			
		||||
   *
 | 
			
		||||
   * @var \Drupal\opencase_entities\Entity\OCOrganisationInterface
 | 
			
		||||
   */
 | 
			
		||||
  protected $revision;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The Organisation storage.
 | 
			
		||||
   *
 | 
			
		||||
   * @var \Drupal\Core\Entity\EntityStorageInterface
 | 
			
		||||
   */
 | 
			
		||||
  protected $oCOrganisationStorage;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The database connection.
 | 
			
		||||
   *
 | 
			
		||||
   * @var \Drupal\Core\Database\Connection
 | 
			
		||||
   */
 | 
			
		||||
  protected $connection;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public static function create(ContainerInterface $container) {
 | 
			
		||||
    $instance = parent::create($container);
 | 
			
		||||
    $instance->oCOrganisationStorage = $container->get('entity_type.manager')->getStorage('oc_organisation');
 | 
			
		||||
    $instance->connection = $container->get('database');
 | 
			
		||||
    return $instance;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getFormId() {
 | 
			
		||||
    return 'oc_organisation_revision_delete_confirm';
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getQuestion() {
 | 
			
		||||
    return $this->t('Are you sure you want to delete the revision from %revision-date?', [
 | 
			
		||||
      '%revision-date' => format_date($this->revision->getRevisionCreationTime()),
 | 
			
		||||
    ]);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getCancelUrl() {
 | 
			
		||||
    return new Url('entity.oc_organisation.version_history', ['oc_organisation' => $this->revision->id()]);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getConfirmText() {
 | 
			
		||||
    return $this->t('Delete');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function buildForm(array $form, FormStateInterface $form_state, $oc_organisation_revision = NULL) {
 | 
			
		||||
    $this->revision = $this->OCOrganisationStorage->loadRevision($oc_organisation_revision);
 | 
			
		||||
    $form = parent::buildForm($form, $form_state);
 | 
			
		||||
 | 
			
		||||
    return $form;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function submitForm(array &$form, FormStateInterface $form_state) {
 | 
			
		||||
    $this->OCOrganisationStorage->deleteRevision($this->revision->getRevisionId());
 | 
			
		||||
 | 
			
		||||
    $this->logger('content')->notice('Organisation: deleted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]);
 | 
			
		||||
    $this->messenger()->addMessage(t('Revision from %revision-date of Organisation %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()]));
 | 
			
		||||
    $form_state->setRedirect(
 | 
			
		||||
      'entity.oc_organisation.canonical',
 | 
			
		||||
       ['oc_organisation' => $this->revision->id()]
 | 
			
		||||
    );
 | 
			
		||||
    if ($this->connection->query('SELECT COUNT(DISTINCT vid) FROM {oc_organisation_field_revision} WHERE id = :id', [':id' => $this->revision->id()])->fetchField() > 1) {
 | 
			
		||||
      $form_state->setRedirect(
 | 
			
		||||
        'entity.oc_organisation.version_history',
 | 
			
		||||
         ['oc_organisation' => $this->revision->id()]
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user