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
|
||||
module:
|
||||
- system
|
||||
- user
|
||||
theme:
|
||||
- bartik
|
||||
id: opencase
|
||||
theme: bartik
|
||||
region: sidebar_first
|
||||
weight: -6
|
||||
weight: -7
|
||||
provider: null
|
||||
plugin: 'system_menu_block:opencase-admin'
|
||||
settings:
|
||||
@ -21,11 +20,4 @@ settings:
|
||||
label_display: visible
|
||||
level: 1
|
||||
depth: 0
|
||||
visibility:
|
||||
user_role:
|
||||
id: user_role
|
||||
roles:
|
||||
administrator: administrator
|
||||
negate: false
|
||||
context_mapping:
|
||||
user: '@user.current_user_context:current_user'
|
||||
visibility: { }
|
||||
|
@ -16,9 +16,9 @@ provider: null
|
||||
plugin: 'system_menu_block:opencase-add-actors'
|
||||
settings:
|
||||
id: 'system_menu_block:opencase-add-actors'
|
||||
label: 'OpenCase Add Actors'
|
||||
label: 'Add Records'
|
||||
provider: system
|
||||
label_display: '0'
|
||||
label_display: visible
|
||||
level: 1
|
||||
depth: 0
|
||||
visibility:
|
||||
|
@ -11,7 +11,7 @@ dependencies:
|
||||
id: opencaseglobal
|
||||
theme: bartik
|
||||
region: sidebar_first
|
||||
weight: -7
|
||||
weight: -6
|
||||
provider: null
|
||||
plugin: 'system_menu_block:openc'
|
||||
settings:
|
||||
|
@ -1,8 +1,11 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- user.role.authenticated
|
||||
module:
|
||||
- opencase_entities
|
||||
- user
|
||||
id: activities
|
||||
label: Activities
|
||||
module: views
|
||||
@ -132,6 +135,71 @@ display:
|
||||
entity_type: null
|
||||
entity_field: name
|
||||
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:
|
||||
id: description
|
||||
table: oc_activity_field_data
|
||||
@ -369,6 +437,7 @@ display:
|
||||
- 'languages:language_interface'
|
||||
- url
|
||||
- url.query_args
|
||||
- user.roles
|
||||
tags: { }
|
||||
page_1:
|
||||
display_plugin: page
|
||||
@ -385,4 +454,5 @@ display:
|
||||
- 'languages:language_interface'
|
||||
- url
|
||||
- url.query_args
|
||||
- user.roles
|
||||
tags: { }
|
||||
|
@ -188,6 +188,71 @@ display:
|
||||
entity_type: null
|
||||
entity_field: name
|
||||
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:
|
||||
id: actors_involved_target_id
|
||||
table: oc_case__actors_involved
|
||||
|
@ -11,6 +11,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
||||
* id = "oc_activity_type",
|
||||
* label = @Translation("Activity type"),
|
||||
* handlers = {
|
||||
* "access" = "Drupal\opencase_entities\OCActivityTypeAccessControlHandler",
|
||||
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
||||
* "list_builder" = "Drupal\opencase_entities\OCActivityTypeListBuilder",
|
||||
* "form" = {
|
||||
|
@ -11,6 +11,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
||||
* id = "oc_actor_type",
|
||||
* label = @Translation("Actor type"),
|
||||
* handlers = {
|
||||
* "access" = "Drupal\opencase_entities\OCActorTypeAccessControlHandler",
|
||||
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
||||
* "list_builder" = "Drupal\opencase_entities\OCActorTypeListBuilder",
|
||||
* "form" = {
|
||||
|
@ -11,6 +11,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
||||
* id = "oc_case_type",
|
||||
* label = @Translation("Case type"),
|
||||
* handlers = {
|
||||
* "access" = "Drupal\opencase_entities\OCCaseTypeAccessControlHandler",
|
||||
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
||||
* "list_builder" = "Drupal\opencase_entities\OCCaseTypeListBuilder",
|
||||
* "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