Added bundle labels to cases & activities views
This involved creating access control handlers for cases and activities (also did one for actors for good measure) and regenerating the opencase_features_opencase_ui feature so as to add the "type" field to the views
This commit is contained in:
parent
12afa00df8
commit
a0ab7282b8
@ -5,13 +5,12 @@ dependencies:
|
|||||||
- system.menu.opencase-admin
|
- system.menu.opencase-admin
|
||||||
module:
|
module:
|
||||||
- system
|
- system
|
||||||
- user
|
|
||||||
theme:
|
theme:
|
||||||
- bartik
|
- bartik
|
||||||
id: opencase
|
id: opencase
|
||||||
theme: bartik
|
theme: bartik
|
||||||
region: sidebar_first
|
region: sidebar_first
|
||||||
weight: -6
|
weight: -7
|
||||||
provider: null
|
provider: null
|
||||||
plugin: 'system_menu_block:opencase-admin'
|
plugin: 'system_menu_block:opencase-admin'
|
||||||
settings:
|
settings:
|
||||||
@ -21,11 +20,4 @@ settings:
|
|||||||
label_display: visible
|
label_display: visible
|
||||||
level: 1
|
level: 1
|
||||||
depth: 0
|
depth: 0
|
||||||
visibility:
|
visibility: { }
|
||||||
user_role:
|
|
||||||
id: user_role
|
|
||||||
roles:
|
|
||||||
administrator: administrator
|
|
||||||
negate: false
|
|
||||||
context_mapping:
|
|
||||||
user: '@user.current_user_context:current_user'
|
|
||||||
|
@ -16,9 +16,9 @@ provider: null
|
|||||||
plugin: 'system_menu_block:opencase-add-actors'
|
plugin: 'system_menu_block:opencase-add-actors'
|
||||||
settings:
|
settings:
|
||||||
id: 'system_menu_block:opencase-add-actors'
|
id: 'system_menu_block:opencase-add-actors'
|
||||||
label: 'OpenCase Add Actors'
|
label: 'Add Records'
|
||||||
provider: system
|
provider: system
|
||||||
label_display: '0'
|
label_display: visible
|
||||||
level: 1
|
level: 1
|
||||||
depth: 0
|
depth: 0
|
||||||
visibility:
|
visibility:
|
||||||
|
@ -11,7 +11,7 @@ dependencies:
|
|||||||
id: opencaseglobal
|
id: opencaseglobal
|
||||||
theme: bartik
|
theme: bartik
|
||||||
region: sidebar_first
|
region: sidebar_first
|
||||||
weight: -7
|
weight: -6
|
||||||
provider: null
|
provider: null
|
||||||
plugin: 'system_menu_block:openc'
|
plugin: 'system_menu_block:openc'
|
||||||
settings:
|
settings:
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies:
|
dependencies:
|
||||||
|
config:
|
||||||
|
- user.role.authenticated
|
||||||
module:
|
module:
|
||||||
- opencase_entities
|
- opencase_entities
|
||||||
|
- user
|
||||||
id: activities
|
id: activities
|
||||||
label: Activities
|
label: Activities
|
||||||
module: views
|
module: views
|
||||||
@ -132,6 +135,71 @@ display:
|
|||||||
entity_type: null
|
entity_type: null
|
||||||
entity_field: name
|
entity_field: name
|
||||||
plugin_id: field
|
plugin_id: field
|
||||||
|
type:
|
||||||
|
id: type
|
||||||
|
table: oc_activity_field_data
|
||||||
|
field: type
|
||||||
|
relationship: none
|
||||||
|
group_type: group
|
||||||
|
admin_label: ''
|
||||||
|
label: Type
|
||||||
|
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: false
|
||||||
|
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
|
||||||
|
entity_type: oc_activity
|
||||||
|
entity_field: type
|
||||||
|
plugin_id: field
|
||||||
description:
|
description:
|
||||||
id: description
|
id: description
|
||||||
table: oc_activity_field_data
|
table: oc_activity_field_data
|
||||||
@ -369,6 +437,7 @@ display:
|
|||||||
- 'languages:language_interface'
|
- 'languages:language_interface'
|
||||||
- url
|
- url
|
||||||
- url.query_args
|
- url.query_args
|
||||||
|
- user.roles
|
||||||
tags: { }
|
tags: { }
|
||||||
page_1:
|
page_1:
|
||||||
display_plugin: page
|
display_plugin: page
|
||||||
@ -385,4 +454,5 @@ display:
|
|||||||
- 'languages:language_interface'
|
- 'languages:language_interface'
|
||||||
- url
|
- url
|
||||||
- url.query_args
|
- url.query_args
|
||||||
|
- user.roles
|
||||||
tags: { }
|
tags: { }
|
||||||
|
@ -188,6 +188,71 @@ display:
|
|||||||
entity_type: null
|
entity_type: null
|
||||||
entity_field: name
|
entity_field: name
|
||||||
plugin_id: field
|
plugin_id: field
|
||||||
|
type:
|
||||||
|
id: type
|
||||||
|
table: oc_case_field_data
|
||||||
|
field: type
|
||||||
|
relationship: none
|
||||||
|
group_type: group
|
||||||
|
admin_label: ''
|
||||||
|
label: Type
|
||||||
|
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: false
|
||||||
|
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
|
||||||
|
entity_type: oc_case
|
||||||
|
entity_field: type
|
||||||
|
plugin_id: field
|
||||||
actors_involved_target_id:
|
actors_involved_target_id:
|
||||||
id: actors_involved_target_id
|
id: actors_involved_target_id
|
||||||
table: oc_case__actors_involved
|
table: oc_case__actors_involved
|
||||||
|
@ -11,6 +11,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
|||||||
* id = "oc_activity_type",
|
* id = "oc_activity_type",
|
||||||
* label = @Translation("Activity type"),
|
* label = @Translation("Activity type"),
|
||||||
* handlers = {
|
* handlers = {
|
||||||
|
* "access" = "Drupal\opencase_entities\OCActivityTypeAccessControlHandler",
|
||||||
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
||||||
* "list_builder" = "Drupal\opencase_entities\OCActivityTypeListBuilder",
|
* "list_builder" = "Drupal\opencase_entities\OCActivityTypeListBuilder",
|
||||||
* "form" = {
|
* "form" = {
|
||||||
|
@ -11,6 +11,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
|||||||
* id = "oc_actor_type",
|
* id = "oc_actor_type",
|
||||||
* label = @Translation("Actor type"),
|
* label = @Translation("Actor type"),
|
||||||
* handlers = {
|
* handlers = {
|
||||||
|
* "access" = "Drupal\opencase_entities\OCActorTypeAccessControlHandler",
|
||||||
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
||||||
* "list_builder" = "Drupal\opencase_entities\OCActorTypeListBuilder",
|
* "list_builder" = "Drupal\opencase_entities\OCActorTypeListBuilder",
|
||||||
* "form" = {
|
* "form" = {
|
||||||
|
@ -11,6 +11,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
|||||||
* id = "oc_case_type",
|
* id = "oc_case_type",
|
||||||
* label = @Translation("Case type"),
|
* label = @Translation("Case type"),
|
||||||
* handlers = {
|
* handlers = {
|
||||||
|
* "access" = "Drupal\opencase_entities\OCCaseTypeAccessControlHandler",
|
||||||
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
||||||
* "list_builder" = "Drupal\opencase_entities\OCCaseTypeListBuilder",
|
* "list_builder" = "Drupal\opencase_entities\OCCaseTypeListBuilder",
|
||||||
* "form" = {
|
* "form" = {
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\opencase_entities;
|
||||||
|
|
||||||
|
use Drupal\Core\Entity\EntityAccessControlHandler;
|
||||||
|
use Drupal\Core\Session\AccountInterface;
|
||||||
|
use Drupal\Core\Entity\EntityInterface;
|
||||||
|
use Drupal\Core\Access\AccessResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the access control handler for the OCActivityType Config Entity.
|
||||||
|
* Always allows viewing the label of the bundle.
|
||||||
|
*
|
||||||
|
* @see Drupal\opencase_entities\Entity\OCActivityType
|
||||||
|
*/
|
||||||
|
class OCActivityTypeAccessControlHandler extends EntityAccessControlHandler {
|
||||||
|
|
||||||
|
protected $viewLabelOperation = TRUE;
|
||||||
|
|
||||||
|
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
|
||||||
|
if ($operation == 'view label') {
|
||||||
|
return AccessResult::allowed();
|
||||||
|
}
|
||||||
|
return parent::checkAccess();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\opencase_entities;
|
||||||
|
|
||||||
|
use Drupal\Core\Entity\EntityAccessControlHandler;
|
||||||
|
use Drupal\Core\Session\AccountInterface;
|
||||||
|
use Drupal\Core\Entity\EntityInterface;
|
||||||
|
use Drupal\Core\Access\AccessResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the access control handler for the OCActorType Config Entity.
|
||||||
|
* Always allows viewing the label of the bundle.
|
||||||
|
*
|
||||||
|
* @see Drupal\opencase_entities\Entity\OCActorType
|
||||||
|
*/
|
||||||
|
class OCActorTypeAccessControlHandler extends EntityAccessControlHandler {
|
||||||
|
|
||||||
|
protected $viewLabelOperation = TRUE;
|
||||||
|
|
||||||
|
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
|
||||||
|
if ($operation == 'view label') {
|
||||||
|
return AccessResult::allowed();
|
||||||
|
}
|
||||||
|
return parent::checkAccess();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\opencase_entities;
|
||||||
|
|
||||||
|
use Drupal\Core\Entity\EntityAccessControlHandler;
|
||||||
|
use Drupal\Core\Session\AccountInterface;
|
||||||
|
use Drupal\Core\Entity\EntityInterface;
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
class OCCaseTypeAccessControlHandler extends EntityAccessControlHandler {
|
||||||
|
|
||||||
|
protected $viewLabelOperation = TRUE;
|
||||||
|
|
||||||
|
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
|
||||||
|
if ($operation == 'view label') {
|
||||||
|
return AccessResult::allowed();
|
||||||
|
}
|
||||||
|
return parent::checkAccess();
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user