diff --git a/config/optional/core.extension.yml b/config/optional/core.extension.yml index b48be27..22ae288 100644 --- a/config/optional/core.extension.yml +++ b/config/optional/core.extension.yml @@ -81,6 +81,7 @@ module: views_aggregator: 0 views_aggregator_more_functions: 0 views_autosubmit: 0 + views_contextual_filters_or: 0 views_data_export: 0 views_summarize: 0 views_ui: 0 diff --git a/config/optional/views.view.activities.yml b/config/optional/views.view.activities.yml index bdd9d74..714863d 100644 --- a/config/optional/views.view.activities.yml +++ b/config/optional/views.view.activities.yml @@ -155,6 +155,71 @@ display: multi_type: separator separator: ', ' field_api_classes: false + oc_target: + id: oc_target + table: oc_activity_field_data + field: oc_target + relationship: none + group_type: group + admin_label: '' + entity_type: oc_activity + entity_field: oc_target + plugin_id: field + label: Target + 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: target_id + type: entity_reference_label + settings: + link: true + group_column: target_id + 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 oc_provider: id: oc_provider table: oc_activity_field_data @@ -426,6 +491,44 @@ display: validate_options: { } break_phrase: false not: false + oc_provider: + id: oc_provider + table: oc_activity_field_data + field: oc_provider + relationship: none + group_type: group + admin_label: '' + entity_type: oc_activity + entity_field: oc_provider + plugin_id: numeric + default_action: default + exception: + value: all + title_enable: false + title: All + title_enable: false + title: '' + default_argument_type: raw + default_argument_options: + index: 2 + use_alias: false + default_argument_skip_url: false + summary_options: + base_path: '' + count: true + override: false + items_per_page: 25 + 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 filters: { } style: type: table @@ -434,11 +537,51 @@ display: row_class: '' default_row_class: true columns: + type: type + activity_date_time: activity_date_time + oc_target: oc_target + oc_provider: oc_provider name: name + description: description default: '-1' info: + type: + sortable: true + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + activity_date_time: + sortable: true + default_sort_order: desc + align: '' + separator: '' + empty_column: false + responsive: '' + oc_target: + sortable: true + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + oc_provider: + sortable: true + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' name: - sortable: false + sortable: true + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + description: + sortable: true default_sort_order: asc align: '' separator: '' @@ -465,6 +608,7 @@ display: distinct: false replica: false query_tags: { } + contextual_filters_or: true relationships: { } header: { } footer: { } diff --git a/opencase.module b/opencase.module index 5fa0d87..cb90300 100644 --- a/opencase.module +++ b/opencase.module @@ -127,6 +127,19 @@ function opencase_entity_field_access($operation, \Drupal\Core\Field\FieldDefini return AccessResult::neutral(); } +/* + Implementation of hook_relevant_activity_type_ids which is a custom hook invoked in the AddActivity block. +*/ +function opencase_relevant_activity_type_ids($actorTypeID) { + switch ($actorTypeID) { + case 'volunteer': + return ['email', 'phone_call', 'supervision']; + case 'client': + return ['email', 'lete', 'phone_call', 'case_note', 'destitution_funds_provided', 'research', 'application']; + case 'staff_member': + return ['application', 'interview']; + } +} /** * Implementation of hook_form_alter() diff --git a/src/Plugin/Block/AddActivity.php b/src/Plugin/Block/AddActivity.php index 8150b5c..0f32ce5 100644 --- a/src/Plugin/Block/AddActivity.php +++ b/src/Plugin/Block/AddActivity.php @@ -19,9 +19,11 @@ class AddActivity extends BlockBase { * {@inheritdoc} */ public function build():array { - $target_id = \Drupal::routeMatch()->getParameter('oc_actor')->id(); - $activity_types = \Drupal::service('entity_type.bundle.info')->getBundleInfo('oc_activity'); + $actor = \Drupal::routeMatch()->getParameter('oc_actor'); + $target_id = $actor->id(); + $actorType = $actor->bundle(); $markup = "