Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
3f3945f9a0 | |||
1cb3a4356a | |||
34ac278a2e | |||
b7cfaa9f64 | |||
0df9cfecc8 | |||
27f0b33faa | |||
998f72f505 | |||
4ac33273b9 | |||
62a3df034e | |||
df44524498 | |||
8d5dda3a7a | |||
74fac415c8 | |||
20cc8cd753 | |||
4647ef6e3e | |||
1a7757394e | |||
fbdc64de3c |
@ -10,6 +10,7 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"composer/installers": "*",
|
"composer/installers": "*",
|
||||||
"drupal/superfish": "*",
|
"drupal/superfish": "*",
|
||||||
|
"drupal/views_autosubmit": "*",
|
||||||
"drupal/smtp": "*",
|
"drupal/smtp": "*",
|
||||||
"drupal/paragraphs_collapsible": "*"
|
"drupal/paragraphs_collapsible": "*"
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
langcode: en
|
||||||
|
status: true
|
||||||
|
dependencies:
|
||||||
|
config:
|
||||||
|
- views.view.equal_opps_records
|
||||||
|
module:
|
||||||
|
- system
|
||||||
|
- views
|
||||||
|
theme:
|
||||||
|
- bartik
|
||||||
|
id: exposedformequal_opps_recordspage_1
|
||||||
|
theme: bartik
|
||||||
|
region: content
|
||||||
|
weight: 0
|
||||||
|
provider: null
|
||||||
|
plugin: 'views_exposed_filter_block:equal_opps_records-page_1'
|
||||||
|
settings:
|
||||||
|
id: 'views_exposed_filter_block:equal_opps_records-page_1'
|
||||||
|
label: ''
|
||||||
|
provider: views
|
||||||
|
label_display: visible
|
||||||
|
views_label: 'Search by (whole) first or last name.'
|
||||||
|
visibility:
|
||||||
|
request_path:
|
||||||
|
id: request_path
|
||||||
|
pages: /equal-opps-records
|
||||||
|
negate: false
|
||||||
|
context_mapping: { }
|
308
config/install/views.view.equal_opps_records.yml
Normal file
308
config/install/views.view.equal_opps_records.yml
Normal file
@ -0,0 +1,308 @@
|
|||||||
|
langcode: en
|
||||||
|
status: true
|
||||||
|
dependencies:
|
||||||
|
config:
|
||||||
|
- system.menu.opencase
|
||||||
|
module:
|
||||||
|
- opencase_entities
|
||||||
|
- user
|
||||||
|
- views_autosubmit
|
||||||
|
id: equal_opps_records
|
||||||
|
label: 'Equal Opps Records'
|
||||||
|
module: views
|
||||||
|
description: ''
|
||||||
|
tag: ''
|
||||||
|
base_table: oc_equal_opps
|
||||||
|
base_field: id
|
||||||
|
display:
|
||||||
|
default:
|
||||||
|
display_plugin: default
|
||||||
|
id: default
|
||||||
|
display_title: Master
|
||||||
|
position: 0
|
||||||
|
display_options:
|
||||||
|
access:
|
||||||
|
type: perm
|
||||||
|
options:
|
||||||
|
perm: 'view published equal opps 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: autosubmit
|
||||||
|
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
|
||||||
|
autosubmit_hide: true
|
||||||
|
pager:
|
||||||
|
type: mini
|
||||||
|
options:
|
||||||
|
items_per_page: 10
|
||||||
|
offset: 0
|
||||||
|
id: 0
|
||||||
|
total_pages: null
|
||||||
|
expose:
|
||||||
|
items_per_page: false
|
||||||
|
items_per_page_label: 'Items per page'
|
||||||
|
items_per_page_options: '5, 10, 25, 50'
|
||||||
|
items_per_page_options_all: false
|
||||||
|
items_per_page_options_all_label: '- All -'
|
||||||
|
offset: false
|
||||||
|
offset_label: Offset
|
||||||
|
tags:
|
||||||
|
previous: ‹‹
|
||||||
|
next: ››
|
||||||
|
style:
|
||||||
|
type: table
|
||||||
|
row:
|
||||||
|
type: fields
|
||||||
|
fields:
|
||||||
|
name:
|
||||||
|
id: name
|
||||||
|
table: oc_equal_opps
|
||||||
|
field: name
|
||||||
|
relationship: none
|
||||||
|
group_type: group
|
||||||
|
admin_label: ''
|
||||||
|
label: 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: true
|
||||||
|
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: null
|
||||||
|
entity_field: name
|
||||||
|
plugin_id: field
|
||||||
|
filters:
|
||||||
|
status:
|
||||||
|
value: '1'
|
||||||
|
table: oc_equal_opps
|
||||||
|
field: status
|
||||||
|
plugin_id: boolean
|
||||||
|
entity_type: oc_equal_opps
|
||||||
|
entity_field: status
|
||||||
|
id: status
|
||||||
|
expose:
|
||||||
|
operator: ''
|
||||||
|
operator_limit_selection: false
|
||||||
|
operator_list: { }
|
||||||
|
group: 1
|
||||||
|
first_name:
|
||||||
|
id: first_name
|
||||||
|
table: oc_actor_field_data
|
||||||
|
field: first_name
|
||||||
|
relationship: oc_actor
|
||||||
|
group_type: group
|
||||||
|
admin_label: ''
|
||||||
|
operator: '='
|
||||||
|
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'
|
||||||
|
gno_standard_user: '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_data
|
||||||
|
field: last_name
|
||||||
|
relationship: oc_actor
|
||||||
|
group_type: group
|
||||||
|
admin_label: ''
|
||||||
|
operator: '='
|
||||||
|
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'
|
||||||
|
gno_standard_user: '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: { }
|
||||||
|
title: 'Equal Opps Records'
|
||||||
|
header: { }
|
||||||
|
footer: { }
|
||||||
|
empty:
|
||||||
|
area:
|
||||||
|
id: area
|
||||||
|
table: views
|
||||||
|
field: area
|
||||||
|
relationship: none
|
||||||
|
group_type: group
|
||||||
|
admin_label: ''
|
||||||
|
empty: true
|
||||||
|
tokenize: false
|
||||||
|
content:
|
||||||
|
value: 'There is no Equal Opps record by that name. Please check the spelling'
|
||||||
|
format: basic_html
|
||||||
|
plugin_id: text
|
||||||
|
relationships:
|
||||||
|
oc_actor:
|
||||||
|
id: oc_actor
|
||||||
|
table: oc_equal_opps
|
||||||
|
field: oc_actor
|
||||||
|
relationship: none
|
||||||
|
group_type: group
|
||||||
|
admin_label: Person
|
||||||
|
required: true
|
||||||
|
entity_type: oc_equal_opps
|
||||||
|
entity_field: oc_actor
|
||||||
|
plugin_id: standard
|
||||||
|
arguments: { }
|
||||||
|
display_extenders: { }
|
||||||
|
use_ajax: true
|
||||||
|
cache_metadata:
|
||||||
|
max-age: -1
|
||||||
|
contexts:
|
||||||
|
- 'languages:language_content'
|
||||||
|
- 'languages:language_interface'
|
||||||
|
- url
|
||||||
|
- url.query_args
|
||||||
|
- user.permissions
|
||||||
|
tags: { }
|
||||||
|
page_1:
|
||||||
|
display_plugin: page
|
||||||
|
id: page_1
|
||||||
|
display_title: Page
|
||||||
|
position: 1
|
||||||
|
display_options:
|
||||||
|
display_extenders: { }
|
||||||
|
path: equal-opps-records
|
||||||
|
exposed_block: true
|
||||||
|
menu:
|
||||||
|
type: normal
|
||||||
|
title: 'Equal Opps Records'
|
||||||
|
description: ''
|
||||||
|
expanded: false
|
||||||
|
parent: opencase.see_all
|
||||||
|
weight: 10
|
||||||
|
context: '0'
|
||||||
|
menu_name: opencase
|
||||||
|
cache_metadata:
|
||||||
|
max-age: -1
|
||||||
|
contexts:
|
||||||
|
- 'languages:language_content'
|
||||||
|
- 'languages:language_interface'
|
||||||
|
- url
|
||||||
|
- url.query_args
|
||||||
|
- user.permissions
|
||||||
|
tags: { }
|
@ -1,7 +1,26 @@
|
|||||||
|
/* MOVE THIS INTO MORE!! */
|
||||||
|
.top_ups_bought.add-activity-link {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* */
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-size: 100% !important;
|
font-size: 100% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.field--type-entity-reference-revisions .field__items {
|
||||||
|
margin-left: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field--type-entity-reference-revisions .field__items .field{
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
.field--type-entity-reference-revisions .field__items .paragraph{
|
||||||
|
margin-top: 0.5em;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
/* remove this confusing thing from user creation page */
|
/* remove this confusing thing from user creation page */
|
||||||
#edit-password-policy-status {
|
#edit-password-policy-status {
|
||||||
display: none;
|
display: none;
|
||||||
|
@ -23,15 +23,12 @@ function template_preprocess_oc_case(array &$variables) {
|
|||||||
// Separate the fields into two sections to be displayed in two columns.
|
// Separate the fields into two sections to be displayed in two columns.
|
||||||
// Remove the name (title) field as this is displayed anyway.
|
// Remove the name (title) field as this is displayed anyway.
|
||||||
$variables['id'] = $variables['elements']['#oc_case']->get('id')[0]->get('value')->getValue();
|
$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['base_fields'] = array();
|
||||||
$variables['other_fields'] = array();
|
$variables['other_fields'] = array();
|
||||||
foreach (Element::children($variables['elements']) as $key) {
|
foreach (Element::children($variables['elements']) as $key) {
|
||||||
$variables['content'][$key] = $variables['elements'][$key];
|
$variables['content'][$key] = $variables['elements'][$key];
|
||||||
if (in_array($key, ['created', 'changed', 'files', 'actors_involved', 'status', 'user_id'])) {
|
if (in_array($key, ['created', 'changed', 'files', 'actors_involved', 'status', 'user_id'])) {
|
||||||
$variables['base_fields'][$key] = $variables['elements'][$key];
|
$variables['base_fields'][$key] = $variables['elements'][$key];
|
||||||
} else if (strpos($key, "entity_view") !== false) {
|
|
||||||
$variables['eva_fields'][$key] = $variables['elements'][$key];
|
|
||||||
} else {
|
} else {
|
||||||
$variables['other_fields'][$key] = $variables['elements'][$key];
|
$variables['other_fields'][$key] = $variables['elements'][$key];
|
||||||
unset($variables['other_fields']['name']);
|
unset($variables['other_fields']['name']);
|
||||||
|
@ -66,13 +66,14 @@ function opencase_cases_entity_base_field_info($entity_type) {
|
|||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* When creating an activity, it sets the case id from the URL.
|
/**
|
||||||
/*/
|
* 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'));
|
function opencase_cases_default_activity_case_value() {
|
||||||
|
return array(\Drupal::request()->query->get('case_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of hook_form_alter()
|
* Implementation of hook_form_alter()
|
||||||
* Changes what page is redirected to after deleting things
|
* Changes what page is redirected to after deleting things
|
||||||
*/
|
*/
|
||||||
@ -85,31 +86,31 @@ function opencase_cases_form_alter(&$form, &$form_state, $form_id) {
|
|||||||
$form['actions']['submit']['#submit'][] = '_opencase_cases_delete_activity_redirect';
|
$form['actions']['submit']['#submit'][] = '_opencase_cases_delete_activity_redirect';
|
||||||
$form['actions']['cancel']['#url'] = $form_state->getFormObject()->getEntity()->toUrl();
|
$form['actions']['cancel']['#url'] = $form_state->getFormObject()->getEntity()->toUrl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _opencase_cases_redirect_to_home($form, &$form_state) {
|
function _opencase_cases_redirect_to_home($form, &$form_state) {
|
||||||
$form_state->setRedirect('<front>');
|
$form_state->setRedirect('<front>');
|
||||||
|
}
|
||||||
function _opencase_cases_delete_activity_redirect($form, &$form_state) {
|
function _opencase_cases_delete_activity_redirect($form, &$form_state) {
|
||||||
$case_id = $form_state->getFormObject()->getEntity()->oc_case->target_id;
|
$case_id = $form_state->getFormObject()->getEntity()->oc_case->target_id;
|
||||||
$form_state->setRedirect('entity.oc_case.canonical', ['oc_case' => $case_id]);
|
$form_state->setRedirect('entity.oc_case.canonical', ['oc_case' => $case_id]);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Implements hook_theme_suggestions_HOOK().
|
* Implements hook_theme_suggestions_HOOK().
|
||||||
*/
|
*/
|
||||||
function opencase_cases_theme_suggestions_oc_case(array $variables) {
|
function opencase_cases_theme_suggestions_oc_case(array $variables) {
|
||||||
$suggestions = [];
|
$suggestions = [];
|
||||||
$entity = $variables['elements']['#oc_case'];
|
$entity = $variables['elements']['#oc_case'];
|
||||||
$sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
|
$sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
|
||||||
|
|
||||||
$suggestions[] = 'oc_case__' . $sanitized_view_mode;
|
$suggestions[] = 'oc_case__' . $sanitized_view_mode;
|
||||||
$suggestions[] = 'oc_case__' . $entity->bundle();
|
$suggestions[] = 'oc_case__' . $entity->bundle();
|
||||||
$suggestions[] = 'oc_case__' . $entity->bundle() . '__' . $sanitized_view_mode;
|
$suggestions[] = 'oc_case__' . $entity->bundle() . '__' . $sanitized_view_mode;
|
||||||
$suggestions[] = 'oc_case__' . $entity->id();
|
$suggestions[] = 'oc_case__' . $entity->id();
|
||||||
$suggestions[] = 'oc_case__' . $entity->id() . '__' . $sanitized_view_mode;
|
$suggestions[] = 'oc_case__' . $entity->id() . '__' . $sanitized_view_mode;
|
||||||
return $suggestions;
|
return $suggestions;
|
||||||
}
|
}
|
||||||
|
|
||||||
function opencase_views_query_alter(Drupal\views\ViewExecutable $view, $query) {
|
function opencase_views_query_alter(Drupal\views\ViewExecutable $view, $query) {
|
||||||
if ($view->getBaseEntityType() && $view->getBaseEntityType()->id() == 'oc_case') {
|
if ($view->getBaseEntityType() && $view->getBaseEntityType()->id() == 'oc_case') {
|
||||||
$query->addTag('oc_case_access');
|
$query->addTag('oc_case_access');
|
||||||
@ -117,8 +118,8 @@ function opencase_views_query_alter(Drupal\views\ViewExecutable $view, $query) {
|
|||||||
if ($view->getBaseEntityType() && $view->getBaseEntityType()->id() == 'oc_activity') {
|
if ($view->getBaseEntityType() && $view->getBaseEntityType()->id() == 'oc_activity') {
|
||||||
$query->addTag('oc_activity_access');
|
$query->addTag('oc_activity_access');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function opencase_query_oc_case_access_alter($query) {
|
function opencase_query_oc_case_access_alter($query) {
|
||||||
if (\Drupal::currentUser()->hasPermission('view published case entities')) {
|
if (\Drupal::currentUser()->hasPermission('view published case entities')) {
|
||||||
return;
|
return;
|
||||||
@ -126,8 +127,8 @@ function opencase_query_oc_case_access_alter($query) {
|
|||||||
$linked_actor_id = CaseInvolvement::getLinkedActorId(\Drupal::currentUser());
|
$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->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);
|
$query->condition('access_filter.actors_involved_target_id', $linked_actor_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function opencase_query_oc_activity_access_alter($query) {
|
function opencase_query_oc_activity_access_alter($query) {
|
||||||
if (\Drupal::currentUser()->hasPermission('view published case entities')) {
|
if (\Drupal::currentUser()->hasPermission('view published case entities')) {
|
||||||
return;
|
return;
|
||||||
@ -135,4 +136,4 @@ function opencase_query_oc_activity_access_alter($query) {
|
|||||||
$linked_actor_id = CaseInvolvement::getLinkedActorId(\Drupal::currentUser());
|
$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->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);
|
$query->condition('access_filter.actors_involved_target_id', $linked_actor_id);
|
||||||
}
|
}
|
||||||
|
@ -29,10 +29,5 @@
|
|||||||
{{ field }}
|
{{ field }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="eva_fields">
|
|
||||||
{% for field in eva_fields %}
|
|
||||||
{{ field }}
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
30
modules/opencase_entities/oc_equal_opps.page.inc
Normal file
30
modules/opencase_entities/oc_equal_opps.page.inc
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Contains oc_equal_opps.page.inc.
|
||||||
|
*
|
||||||
|
* Page callback for Equal Opps entities.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Drupal\Core\Render\Element;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares variables for Equal Opps templates.
|
||||||
|
*
|
||||||
|
* Default template: oc_equal_opps.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_equal_opps(array &$variables) {
|
||||||
|
// Fetch OCEqualOpps Entity Object.
|
||||||
|
$oc_equal_opps = $variables['elements']['#oc_equal_opps'];
|
||||||
|
|
||||||
|
// Helpful $content variable for templates.
|
||||||
|
foreach (Element::children($variables['elements']) as $key) {
|
||||||
|
$variables['content'][$key] = $variables['elements'][$key];
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,31 @@
|
|||||||
|
|
||||||
|
|
||||||
use \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchemaConverter;
|
use \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchemaConverter;
|
||||||
|
use \Drupal\Core\Field\BaseFieldDefinition;
|
||||||
|
|
||||||
|
function opencase_entities_update_80199() {
|
||||||
|
$field_storage_definition = BaseFieldDefinition::create('string')
|
||||||
|
->setLabel(t('Contact Role'))
|
||||||
|
->setDescription(t('Role of the contact within the organisation'))
|
||||||
|
->setRevisionable(TRUE)
|
||||||
|
->setSettings([
|
||||||
|
'max_length' => 50,
|
||||||
|
'text_processing' => 0,
|
||||||
|
])
|
||||||
|
->setDefaultValue('')
|
||||||
|
->setDisplayOptions('view', [
|
||||||
|
'label' => 'above',
|
||||||
|
'type' => 'string',
|
||||||
|
'weight' => 52,
|
||||||
|
])
|
||||||
|
->setDisplayOptions('form', [
|
||||||
|
'type' => 'string_textfield',
|
||||||
|
'weight' => 52,
|
||||||
|
])
|
||||||
|
->setRequired(FALSE);
|
||||||
|
\Drupal::entityDefinitionUpdateManager()
|
||||||
|
->installFieldStorageDefinition('contact_role', 'oc_organisation', 'opencase_entities', $field_storage_definition);
|
||||||
|
}
|
||||||
|
|
||||||
function opencase_entities_update_80198() {
|
function opencase_entities_update_80198() {
|
||||||
$field_storage_definition = \Drupal\Core\Field\BaseFieldDefinition::create('file')
|
$field_storage_definition = \Drupal\Core\Field\BaseFieldDefinition::create('file')
|
||||||
|
@ -45,3 +45,8 @@ entity.oc_bank_account.add_form:
|
|||||||
title: 'Add Bank Account'
|
title: 'Add Bank Account'
|
||||||
appears_on:
|
appears_on:
|
||||||
- entity.oc_bank_account.collection
|
- entity.oc_bank_account.collection
|
||||||
|
entity.oc_equal_opps.add_form:
|
||||||
|
route_name: entity.oc_equal_opps.add_form
|
||||||
|
title: 'Add Equal Opps'
|
||||||
|
appears_on:
|
||||||
|
- entity.oc_equal_opps.collection
|
||||||
|
@ -82,3 +82,17 @@ oc_bank_account.admin.structure.settings:
|
|||||||
description: 'Configure Bank Account entities'
|
description: 'Configure Bank Account entities'
|
||||||
route_name: oc_bank_account.settings
|
route_name: oc_bank_account.settings
|
||||||
parent: system.admin_structure
|
parent: system.admin_structure
|
||||||
|
|
||||||
|
# Equal Opps menu items definition
|
||||||
|
entity.oc_equal_opps.collection:
|
||||||
|
title: 'Equal Opps list'
|
||||||
|
route_name: entity.oc_equal_opps.collection
|
||||||
|
description: 'List Equal Opps entities'
|
||||||
|
parent: system.admin_structure
|
||||||
|
weight: 100
|
||||||
|
|
||||||
|
oc_equal_opps.admin.structure.settings:
|
||||||
|
title: 'Equal Opps settings'
|
||||||
|
description: 'Configure Equal Opps entities'
|
||||||
|
route_name: oc_equal_opps.settings
|
||||||
|
parent: system.admin_structure
|
||||||
|
@ -105,3 +105,24 @@ entity.oc_bank_account.delete_form:
|
|||||||
base_route: entity.oc_bank_account.canonical
|
base_route: entity.oc_bank_account.canonical
|
||||||
title: Delete
|
title: Delete
|
||||||
weight: 10
|
weight: 10
|
||||||
|
# Equal Opps routing definition
|
||||||
|
oc_equal_opps.settings_tab:
|
||||||
|
route_name: oc_equal_opps.settings
|
||||||
|
title: 'Settings'
|
||||||
|
base_route: oc_equal_opps.settings
|
||||||
|
|
||||||
|
entity.oc_equal_opps.canonical:
|
||||||
|
route_name: entity.oc_equal_opps.canonical
|
||||||
|
base_route: entity.oc_equal_opps.canonical
|
||||||
|
title: 'View'
|
||||||
|
|
||||||
|
entity.oc_equal_opps.edit_form:
|
||||||
|
route_name: entity.oc_equal_opps.edit_form
|
||||||
|
base_route: entity.oc_equal_opps.canonical
|
||||||
|
title: 'Edit'
|
||||||
|
|
||||||
|
entity.oc_equal_opps.delete_form:
|
||||||
|
route_name: entity.oc_equal_opps.delete_form
|
||||||
|
base_route: entity.oc_equal_opps.canonical
|
||||||
|
title: Delete
|
||||||
|
weight: 10
|
||||||
|
@ -157,3 +157,23 @@ view published bank account entities:
|
|||||||
view unpublished bank account entities:
|
view unpublished bank account entities:
|
||||||
title: 'View unpublished Bank Account entities'
|
title: 'View unpublished Bank Account entities'
|
||||||
|
|
||||||
|
add equal opps entities:
|
||||||
|
title: 'Create new Equal Opps entities'
|
||||||
|
|
||||||
|
administer equal opps entities:
|
||||||
|
title: 'Administer Equal Opps entities'
|
||||||
|
description: 'Allow to access the administration form to configure Equal Opps entities.'
|
||||||
|
restrict access: true
|
||||||
|
|
||||||
|
delete equal opps entities:
|
||||||
|
title: 'Delete Equal Opps entities'
|
||||||
|
|
||||||
|
edit equal opps entities:
|
||||||
|
title: 'Edit Equal Opps entities'
|
||||||
|
|
||||||
|
view published equal opps entities:
|
||||||
|
title: 'View published Equal Opps entities'
|
||||||
|
|
||||||
|
view unpublished equal opps entities:
|
||||||
|
title: 'View unpublished Equal Opps entities'
|
||||||
|
|
||||||
|
@ -268,8 +268,9 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
|||||||
->setDefaultValue('')
|
->setDefaultValue('')
|
||||||
->setDisplayOptions('form', [
|
->setDisplayOptions('form', [
|
||||||
'type' => 'string_textfield',
|
'type' => 'string_textfield',
|
||||||
'weight' => -9,
|
'weight' => -100,
|
||||||
]);
|
])
|
||||||
|
->setRequired(TRUE);
|
||||||
|
|
||||||
$fields['middle_names'] = BaseFieldDefinition::create('string')
|
$fields['middle_names'] = BaseFieldDefinition::create('string')
|
||||||
->setLabel(t('Middle Names'))
|
->setLabel(t('Middle Names'))
|
||||||
@ -284,7 +285,7 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
|||||||
->setDefaultValue('')
|
->setDefaultValue('')
|
||||||
->setDisplayOptions('form', [
|
->setDisplayOptions('form', [
|
||||||
'type' => 'string_textfield',
|
'type' => 'string_textfield',
|
||||||
'weight' => -8,
|
'weight' => -99,
|
||||||
])
|
])
|
||||||
->setRequired(FALSE);
|
->setRequired(FALSE);
|
||||||
|
|
||||||
@ -301,8 +302,9 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
|||||||
->setDefaultValue('')
|
->setDefaultValue('')
|
||||||
->setDisplayOptions('form', [
|
->setDisplayOptions('form', [
|
||||||
'type' => 'string_textfield',
|
'type' => 'string_textfield',
|
||||||
'weight' => -7,
|
'weight' => -98,
|
||||||
]);
|
])
|
||||||
|
->setRequired(TRUE);
|
||||||
|
|
||||||
// Contact details.
|
// Contact details.
|
||||||
$fields['email'] = BaseFieldDefinition::create('string')
|
$fields['email'] = BaseFieldDefinition::create('string')
|
||||||
|
260
modules/opencase_entities/src/Entity/OCEqualOpps.php
Normal file
260
modules/opencase_entities/src/Entity/OCEqualOpps.php
Normal file
@ -0,0 +1,260 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the Equal Opps entity.
|
||||||
|
*
|
||||||
|
* @ingroup opencase_entities
|
||||||
|
*
|
||||||
|
* @ContentEntityType(
|
||||||
|
* id = "oc_equal_opps",
|
||||||
|
* label = @Translation("Equal Opps"),
|
||||||
|
* handlers = {
|
||||||
|
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
||||||
|
* "list_builder" = "Drupal\opencase_entities\OCEqualOppsListBuilder",
|
||||||
|
* "views_data" = "Drupal\opencase_entities\Entity\OCEqualOppsViewsData",
|
||||||
|
*
|
||||||
|
* "form" = {
|
||||||
|
* "default" = "Drupal\opencase_entities\Form\OCEqualOppsForm",
|
||||||
|
* "add" = "Drupal\opencase_entities\Form\OCEqualOppsForm",
|
||||||
|
* "edit" = "Drupal\opencase_entities\Form\OCEqualOppsForm",
|
||||||
|
* "delete" = "Drupal\opencase_entities\Form\OCEqualOppsDeleteForm",
|
||||||
|
* },
|
||||||
|
* "route_provider" = {
|
||||||
|
* "html" = "Drupal\opencase_entities\OCEqualOppsHtmlRouteProvider",
|
||||||
|
* },
|
||||||
|
* "access" = "Drupal\opencase_entities\OCEqualOppsAccessControlHandler",
|
||||||
|
* },
|
||||||
|
* base_table = "oc_equal_opps",
|
||||||
|
* translatable = FALSE,
|
||||||
|
* admin_permission = "administer equal opps entities",
|
||||||
|
* entity_keys = {
|
||||||
|
* "id" = "id",
|
||||||
|
* "label" = "name",
|
||||||
|
* "uuid" = "uuid",
|
||||||
|
* "langcode" = "langcode",
|
||||||
|
* "published" = "status",
|
||||||
|
* },
|
||||||
|
* links = {
|
||||||
|
* "canonical" = "/opencase/oc_equal_opps/{oc_equal_opps}",
|
||||||
|
* "add-form" = "/opencase/oc_equal_opps/add",
|
||||||
|
* "edit-form" = "/opencase/oc_equal_opps/{oc_equal_opps}/edit",
|
||||||
|
* "delete-form" = "/opencase/oc_equal_opps/{oc_equal_opps}/delete",
|
||||||
|
* "collection" = "/opencase/oc_equal_opps",
|
||||||
|
* },
|
||||||
|
* field_ui_base_route = "oc_equal_opps.settings"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
class OCEqualOpps extends ContentEntityBase implements OCEqualOppsInterface {
|
||||||
|
|
||||||
|
use EntityChangedTrait;
|
||||||
|
use EntityPublishedTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function preSave(EntityStorageInterface $storage) {
|
||||||
|
parent::preSave($storage);
|
||||||
|
// get the name of the person and make that the name of the thing.
|
||||||
|
$name = $this->get('oc_actor')->entity->get('name')->first()->value;
|
||||||
|
$this->setName($name);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* {@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 static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
|
||||||
|
$fields = parent::baseFieldDefinitions($entity_type);
|
||||||
|
|
||||||
|
// Add the published field.
|
||||||
|
$fields += static::publishedBaseFieldDefinitions($entity_type);
|
||||||
|
|
||||||
|
$fields['name'] = BaseFieldDefinition::create('string')
|
||||||
|
->setLabel(t('Name'))
|
||||||
|
->setDescription(t('The name of the Equal Opps entity.'))
|
||||||
|
->setSettings([
|
||||||
|
'max_length' => 50,
|
||||||
|
'text_processing' => 0,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$fields['oc_actor'] = \Drupal\Core\Field\BaseFieldDefinition::create('entity_reference')
|
||||||
|
->setLabel(t('Person'))
|
||||||
|
->setDescription(t('The person this pertains to.'))
|
||||||
|
->setSetting('target_type', 'oc_actor')
|
||||||
|
->setSetting('handler', 'default')
|
||||||
|
->setCardinality(1)
|
||||||
|
->setDisplayOptions('view', [
|
||||||
|
'type' => 'string',
|
||||||
|
'weight' => -100,
|
||||||
|
])
|
||||||
|
->setDisplayOptions('form', [
|
||||||
|
'type' => 'entity_reference_autocomplete_tags',
|
||||||
|
'weight' => -100,
|
||||||
|
])
|
||||||
|
->setRequired(TRUE);
|
||||||
|
|
||||||
|
$fields['age'] = BaseFieldDefinition::create('list_string')
|
||||||
|
->setLabel(t('Age'))
|
||||||
|
->setRevisionable(TRUE)
|
||||||
|
->setSettings([
|
||||||
|
'allowed_values' => [
|
||||||
|
'18-24' => '18-24',
|
||||||
|
'25-34' => '25-34',
|
||||||
|
'35-44' => '35-44',
|
||||||
|
'45-54' => '45-54',
|
||||||
|
'56-70' => '56-70',
|
||||||
|
'70+' => '70+',
|
||||||
|
],
|
||||||
|
])
|
||||||
|
->setDisplayConfigurable('form', true)
|
||||||
|
->setDisplayOptions('view', array(
|
||||||
|
'label' => 'above',
|
||||||
|
'type' => 'string',
|
||||||
|
'weight' => -5,
|
||||||
|
))
|
||||||
|
->setDisplayOptions('form', array(
|
||||||
|
'type' => 'options_select',
|
||||||
|
'weight' => -5,
|
||||||
|
));
|
||||||
|
$fields['access_needs'] = BaseFieldDefinition::create('string_long')
|
||||||
|
->setLabel(t('Access Needs'))
|
||||||
|
->setRevisionable(TRUE)
|
||||||
|
->setDisplayOptions('view', array(
|
||||||
|
'label' => 'above',
|
||||||
|
'type' => 'string',
|
||||||
|
'weight' => -4,
|
||||||
|
))
|
||||||
|
->setDisplayOptions('form', array(
|
||||||
|
'type' => 'string_long',
|
||||||
|
'weight' => -4,
|
||||||
|
));
|
||||||
|
$fields['gender'] = BaseFieldDefinition::create('list_string')
|
||||||
|
->setRevisionable(TRUE)
|
||||||
|
->setLabel(t('Gender'))
|
||||||
|
->setSettings([
|
||||||
|
'allowed_values' => [
|
||||||
|
'man' => 'Man',
|
||||||
|
'woman' => 'Woman',
|
||||||
|
'non-binary' => 'Non-Binary',
|
||||||
|
'trans-gnc' => 'Trans / GNC',
|
||||||
|
'trans-man' => 'Trans man',
|
||||||
|
'trans-woman' => 'Trans woman',
|
||||||
|
'trans-nb' => 'Trans NB',
|
||||||
|
],
|
||||||
|
])
|
||||||
|
->setDisplayConfigurable('form', true)
|
||||||
|
->setDisplayOptions('view', array(
|
||||||
|
'label' => 'above',
|
||||||
|
'type' => 'string',
|
||||||
|
'weight' => -5,
|
||||||
|
))
|
||||||
|
->setDisplayOptions('form', array(
|
||||||
|
'type' => 'options_select',
|
||||||
|
'weight' => -5,
|
||||||
|
));
|
||||||
|
$fields['race_ethnicity'] = BaseFieldDefinition::create('list_string')
|
||||||
|
->setRevisionable(TRUE)
|
||||||
|
->setLabel(t('Race/Ethnicity'))
|
||||||
|
->setSettings([
|
||||||
|
'allowed_values' => [
|
||||||
|
'white1' => 'White: English, Welsh, Scottish, Northern Irish or British',
|
||||||
|
'white2' => 'White: Irish',
|
||||||
|
'white3' => 'White: Gypsy or Irish Traveller',
|
||||||
|
'white4' => 'White: Any other White background',
|
||||||
|
'mixed1' => 'Mixed: White and Black Caribbean',
|
||||||
|
'mixed2' => 'Mixed: White and Black African',
|
||||||
|
'mixed3' => 'Mixed: White and Asian',
|
||||||
|
'mixed4' => 'Mixed: Other',
|
||||||
|
'asian1' => 'Asian: Indian',
|
||||||
|
'asian2' => 'Asian: Bangladeshi',
|
||||||
|
'asian3' => 'Asian: Pakistani',
|
||||||
|
'asian4' => 'Asian: Chinese',
|
||||||
|
'asian5' => 'Asian: Other',
|
||||||
|
'black1' => 'Black: African',
|
||||||
|
'black2' => 'Black: Caribbean',
|
||||||
|
'black3' => 'Black: Other',
|
||||||
|
'arab' => 'Arab',
|
||||||
|
'other' => 'Other',
|
||||||
|
],
|
||||||
|
])
|
||||||
|
->setDisplayConfigurable('form', true)
|
||||||
|
->setDisplayOptions('view', array(
|
||||||
|
'label' => 'above',
|
||||||
|
'type' => 'string',
|
||||||
|
'weight' => -5,
|
||||||
|
))
|
||||||
|
->setDisplayOptions('form', array(
|
||||||
|
'type' => 'options_select',
|
||||||
|
'weight' => -5,
|
||||||
|
));
|
||||||
|
$fields['sexuality'] = BaseFieldDefinition::create('string')
|
||||||
|
->setLabel(t('Sexuality'))
|
||||||
|
->setRevisionable(TRUE)
|
||||||
|
->setSettings([
|
||||||
|
'max_length' => 20,
|
||||||
|
'text_processing' => 0,
|
||||||
|
])
|
||||||
|
->setDisplayConfigurable("form", true)
|
||||||
|
->setDisplayConfigurable("view", true)
|
||||||
|
->setDefaultValue('')
|
||||||
|
->setDisplayOptions('view', array(
|
||||||
|
'label' => 'above',
|
||||||
|
'type' => 'string',
|
||||||
|
'weight' => -1,
|
||||||
|
))
|
||||||
|
->setDisplayOptions('form', [
|
||||||
|
'type' => 'string_textfield',
|
||||||
|
'weight' => -1,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$fields['status']->setDescription(t('A boolean indicating whether the Equal Opps 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.'));
|
||||||
|
|
||||||
|
return $fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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 Equal Opps entities.
|
||||||
|
*
|
||||||
|
* @ingroup opencase_entities
|
||||||
|
*/
|
||||||
|
interface OCEqualOppsInterface extends ContentEntityInterface, EntityChangedInterface, EntityPublishedInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add get/set methods for your configuration properties here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Equal Opps name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* Name of the Equal Opps.
|
||||||
|
*/
|
||||||
|
public function getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the Equal Opps name.
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* The Equal Opps name.
|
||||||
|
*
|
||||||
|
* @return \Drupal\opencase_entities\Entity\OCEqualOppsInterface
|
||||||
|
* The called Equal Opps entity.
|
||||||
|
*/
|
||||||
|
public function setName($name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Equal Opps creation timestamp.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
* Creation timestamp of the Equal Opps.
|
||||||
|
*/
|
||||||
|
public function getCreatedTime();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the Equal Opps creation timestamp.
|
||||||
|
*
|
||||||
|
* @param int $timestamp
|
||||||
|
* The Equal Opps creation timestamp.
|
||||||
|
*
|
||||||
|
* @return \Drupal\opencase_entities\Entity\OCEqualOppsInterface
|
||||||
|
* The called Equal Opps entity.
|
||||||
|
*/
|
||||||
|
public function setCreatedTime($timestamp);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\opencase_entities\Entity;
|
||||||
|
|
||||||
|
use Drupal\views\EntityViewsData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides Views data for Equal Opps entities.
|
||||||
|
*/
|
||||||
|
class OCEqualOppsViewsData extends EntityViewsData {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getViewsData() {
|
||||||
|
$data = parent::getViewsData();
|
||||||
|
|
||||||
|
// Additional information for Views integration, such as table joins, can be
|
||||||
|
// put here.
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -149,13 +149,7 @@ class OCEvent extends ContentEntityBase implements OCEventInterface {
|
|||||||
->setDescription(t('The user ID of author of the Event entity.'))
|
->setDescription(t('The user ID of author of the Event entity.'))
|
||||||
->setRevisionable(TRUE)
|
->setRevisionable(TRUE)
|
||||||
->setSetting('target_type', 'user')
|
->setSetting('target_type', 'user')
|
||||||
->setSetting('handler', 'default')
|
->setSetting('handler', 'default');
|
||||||
->setTranslatable(TRUE)
|
|
||||||
->setDisplayOptions('view', [
|
|
||||||
'label' => 'inline',
|
|
||||||
'type' => 'author',
|
|
||||||
'weight' => -4,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$fields['name'] = BaseFieldDefinition::create('string')
|
$fields['name'] = BaseFieldDefinition::create('string')
|
||||||
->setLabel(t('Name'))
|
->setLabel(t('Name'))
|
||||||
@ -165,11 +159,6 @@ class OCEvent extends ContentEntityBase implements OCEventInterface {
|
|||||||
'text_processing' => 0,
|
'text_processing' => 0,
|
||||||
])
|
])
|
||||||
->setDefaultValue('')
|
->setDefaultValue('')
|
||||||
->setDisplayOptions('view', [
|
|
||||||
'label' => 'above',
|
|
||||||
'type' => 'string',
|
|
||||||
'weight' => -4,
|
|
||||||
])
|
|
||||||
->setDisplayOptions('form', [
|
->setDisplayOptions('form', [
|
||||||
'type' => 'string_textfield',
|
'type' => 'string_textfield',
|
||||||
'weight' => -4,
|
'weight' => -4,
|
||||||
|
@ -213,7 +213,7 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
|
|||||||
));
|
));
|
||||||
$fields['contact_name'] = BaseFieldDefinition::create('string')
|
$fields['contact_name'] = BaseFieldDefinition::create('string')
|
||||||
->setLabel(t('Contact Name'))
|
->setLabel(t('Contact Name'))
|
||||||
->setDescription(t('Name of the main contact for this client.'))
|
->setDescription(t('Name of the main contact for this organisation.'))
|
||||||
->setRevisionable(TRUE)
|
->setRevisionable(TRUE)
|
||||||
->setSettings([
|
->setSettings([
|
||||||
'max_length' => 50,
|
'max_length' => 50,
|
||||||
@ -231,6 +231,25 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
|
|||||||
])
|
])
|
||||||
->setRequired(FALSE);
|
->setRequired(FALSE);
|
||||||
|
|
||||||
|
$fields['contact_role'] = BaseFieldDefinition::create('string')
|
||||||
|
->setLabel(t('Contact Role'))
|
||||||
|
->setDescription(t('Role of the contact within the organisation'))
|
||||||
|
->setRevisionable(TRUE)
|
||||||
|
->setSettings([
|
||||||
|
'max_length' => 50,
|
||||||
|
'text_processing' => 0,
|
||||||
|
])
|
||||||
|
->setDefaultValue('')
|
||||||
|
->setDisplayOptions('view', [
|
||||||
|
'label' => 'above',
|
||||||
|
'type' => 'string',
|
||||||
|
'weight' => 52,
|
||||||
|
])
|
||||||
|
->setDisplayOptions('form', [
|
||||||
|
'type' => 'string_textfield',
|
||||||
|
'weight' => 52,
|
||||||
|
])
|
||||||
|
->setRequired(FALSE);
|
||||||
$fields['email'] = BaseFieldDefinition::create('string')
|
$fields['email'] = BaseFieldDefinition::create('string')
|
||||||
->setLabel(t('Email Address'))
|
->setLabel(t('Email Address'))
|
||||||
->setRevisionable(TRUE)
|
->setRevisionable(TRUE)
|
||||||
|
15
modules/opencase_entities/src/Form/OCEqualOppsDeleteForm.php
Normal file
15
modules/opencase_entities/src/Form/OCEqualOppsDeleteForm.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\opencase_entities\Form;
|
||||||
|
|
||||||
|
use Drupal\Core\Entity\ContentEntityDeleteForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a form for deleting Equal Opps entities.
|
||||||
|
*
|
||||||
|
* @ingroup opencase_entities
|
||||||
|
*/
|
||||||
|
class OCEqualOppsDeleteForm extends ContentEntityDeleteForm {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
66
modules/opencase_entities/src/Form/OCEqualOppsForm.php
Normal file
66
modules/opencase_entities/src/Form/OCEqualOppsForm.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 Equal Opps edit forms.
|
||||||
|
*
|
||||||
|
* @ingroup opencase_entities
|
||||||
|
*/
|
||||||
|
class OCEqualOppsForm 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\OCEqualOpps $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 Equal Opps.', [
|
||||||
|
'%label' => $entity->label(),
|
||||||
|
]));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$this->messenger()->addMessage($this->t('Saved the %label Equal Opps.', [
|
||||||
|
'%label' => $entity->label(),
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
$form_state->setRedirect('entity.oc_equal_opps.canonical', ['oc_equal_opps' => $entity->id()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\opencase_entities\Form;
|
||||||
|
|
||||||
|
use Drupal\Core\Form\FormBase;
|
||||||
|
use Drupal\Core\Form\FormStateInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class OCEqualOppsSettingsForm.
|
||||||
|
*
|
||||||
|
* @ingroup opencase_entities
|
||||||
|
*/
|
||||||
|
class OCEqualOppsSettingsForm extends FormBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a unique string identifying the form.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* The unique string identifying the form.
|
||||||
|
*/
|
||||||
|
public function getFormId() {
|
||||||
|
return 'ocequalopps_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 Equal Opps 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['ocequalopps_settings']['#markup'] = 'Settings form for Equal Opps entities. Manage field settings here.';
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\opencase_entities;
|
||||||
|
|
||||||
|
use Drupal\Core\Entity\EntityAccessControlHandler;
|
||||||
|
use Drupal\Core\Entity\EntityInterface;
|
||||||
|
use Drupal\Core\Session\AccountInterface;
|
||||||
|
use Drupal\Core\Access\AccessResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Access controller for the Equal Opps entity.
|
||||||
|
*
|
||||||
|
* @see \Drupal\opencase_entities\Entity\OCEqualOpps.
|
||||||
|
*/
|
||||||
|
class OCEqualOppsAccessControlHandler extends EntityAccessControlHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
|
||||||
|
/** @var \Drupal\opencase_entities\Entity\OCEqualOppsInterface $entity */
|
||||||
|
|
||||||
|
switch ($operation) {
|
||||||
|
|
||||||
|
case 'view':
|
||||||
|
|
||||||
|
if (!$entity->isPublished()) {
|
||||||
|
return AccessResult::allowedIfHasPermission($account, 'view unpublished equal opps entities');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return AccessResult::allowedIfHasPermission($account, 'view published equal opps entities');
|
||||||
|
|
||||||
|
case 'update':
|
||||||
|
|
||||||
|
return AccessResult::allowedIfHasPermission($account, 'edit equal opps entities');
|
||||||
|
|
||||||
|
case 'delete':
|
||||||
|
|
||||||
|
return AccessResult::allowedIfHasPermission($account, 'delete equal opps entities');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unknown operation, no opinion.
|
||||||
|
return AccessResult::neutral();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
|
||||||
|
return AccessResult::allowedIfHasPermission($account, 'add equal opps entities');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\opencase_entities;
|
||||||
|
|
||||||
|
use Drupal\Core\Entity\EntityTypeInterface;
|
||||||
|
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
|
||||||
|
use Symfony\Component\Routing\Route;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides routes for Equal Opps entities.
|
||||||
|
*
|
||||||
|
* @see \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
|
||||||
|
* @see \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider
|
||||||
|
*/
|
||||||
|
class OCEqualOppsHtmlRouteProvider extends AdminHtmlRouteProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getRoutes(EntityTypeInterface $entity_type) {
|
||||||
|
$collection = parent::getRoutes($entity_type);
|
||||||
|
|
||||||
|
$entity_type_id = $entity_type->id();
|
||||||
|
|
||||||
|
if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) {
|
||||||
|
$collection->add("$entity_type_id.settings", $settings_form_route);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the settings form route.
|
||||||
|
*
|
||||||
|
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
|
||||||
|
* The entity type.
|
||||||
|
*
|
||||||
|
* @return \Symfony\Component\Routing\Route|null
|
||||||
|
* The generated route, if available.
|
||||||
|
*/
|
||||||
|
protected function getSettingsFormRoute(EntityTypeInterface $entity_type) {
|
||||||
|
if (!$entity_type->getBundleEntityType()) {
|
||||||
|
$route = new Route("/admin/structure/{$entity_type->id()}/settings");
|
||||||
|
$route
|
||||||
|
->setDefaults([
|
||||||
|
'_form' => 'Drupal\opencase_entities\Form\OCEqualOppsSettingsForm',
|
||||||
|
'_title' => "{$entity_type->getLabel()} settings",
|
||||||
|
])
|
||||||
|
->setRequirement('_permission', $entity_type->getAdminPermission())
|
||||||
|
->setOption('_admin_route', TRUE);
|
||||||
|
|
||||||
|
return $route;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
39
modules/opencase_entities/src/OCEqualOppsListBuilder.php
Normal file
39
modules/opencase_entities/src/OCEqualOppsListBuilder.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\opencase_entities;
|
||||||
|
|
||||||
|
use Drupal\Core\Entity\EntityInterface;
|
||||||
|
use Drupal\Core\Entity\EntityListBuilder;
|
||||||
|
use Drupal\Core\Link;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a class to build a listing of Equal Opps entities.
|
||||||
|
*
|
||||||
|
* @ingroup opencase_entities
|
||||||
|
*/
|
||||||
|
class OCEqualOppsListBuilder extends EntityListBuilder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function buildHeader() {
|
||||||
|
$header['id'] = $this->t('Equal Opps ID');
|
||||||
|
$header['name'] = $this->t('Name');
|
||||||
|
return $header + parent::buildHeader();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function buildRow(EntityInterface $entity) {
|
||||||
|
/* @var \Drupal\opencase_entities\Entity\OCEqualOpps $entity */
|
||||||
|
$row['id'] = $entity->id();
|
||||||
|
$row['name'] = Link::createFromRoute(
|
||||||
|
$entity->label(),
|
||||||
|
'entity.oc_equal_opps.edit_form',
|
||||||
|
['oc_equal_opps' => $entity->id()]
|
||||||
|
);
|
||||||
|
return $row + parent::buildRow($entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
22
modules/opencase_entities/templates/oc_equal_opps.html.twig
Normal file
22
modules/opencase_entities/templates/oc_equal_opps.html.twig
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{#
|
||||||
|
/**
|
||||||
|
* @file oc_equal_opps.html.twig
|
||||||
|
* Default theme implementation to present Equal Opps data.
|
||||||
|
*
|
||||||
|
* This template is used when viewing Equal Opps 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_equal_opps()
|
||||||
|
*
|
||||||
|
* @ingroup themeable
|
||||||
|
*/
|
||||||
|
#}
|
||||||
|
<div{{ attributes.addClass('oc_equal_opps') }}>
|
||||||
|
{% if content %}
|
||||||
|
{{- content -}}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
@ -26,6 +26,7 @@ function opencase_no_cases_help($route_name, RouteMatchInterface $route_match) {
|
|||||||
|
|
||||||
function opencase_no_cases_entity_base_field_info($entity_type) {
|
function opencase_no_cases_entity_base_field_info($entity_type) {
|
||||||
if ($entity_type->id() === 'oc_activity') {
|
if ($entity_type->id() === 'oc_activity') {
|
||||||
|
$fields = array();
|
||||||
$fields['actors_involved'] = BaseFieldDefinition::create('entity_reference')
|
$fields['actors_involved'] = BaseFieldDefinition::create('entity_reference')
|
||||||
->setLabel(t('Participants'))
|
->setLabel(t('Participants'))
|
||||||
->setDescription(t('People involved in this activity. To add one, start typing their name.'))
|
->setDescription(t('People involved in this activity. To add one, start typing their name.'))
|
||||||
@ -50,8 +51,8 @@ function opencase_no_cases_entity_base_field_info($entity_type) {
|
|||||||
])
|
])
|
||||||
->setDefaultValueCallback('opencase_no_cases_actors_involved_callback')
|
->setDefaultValueCallback('opencase_no_cases_actors_involved_callback')
|
||||||
->setRequired(TRUE);
|
->setRequired(TRUE);
|
||||||
return $fields;
|
|
||||||
}
|
}
|
||||||
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Drupal\opencase_no_cases\Plugin\Block;
|
|
||||||
|
|
||||||
use Drupal\Core\Block\BlockBase;
|
|
||||||
use Drupal\Core\Link;
|
|
||||||
use Drupal\Core\Url;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides a 'ContextualMenu' block.
|
|
||||||
*
|
|
||||||
* Displays links for adding activities against a person.
|
|
||||||
*
|
|
||||||
* @Block(
|
|
||||||
* id = "opencase_no_cases_contextual_menu",
|
|
||||||
* admin_label = @Translation("OpenCase Contextual Menu"),
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
class ContextualMenu extends BlockBase {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function build() {
|
|
||||||
$route_name = \Drupal::routeMatch()->getRouteName();
|
|
||||||
\Drupal::logger('my_module')->error(\Drupal::routeMatch()->getParameter('oc_actor')->bundle());
|
|
||||||
if ($route_name == 'entity.oc_actor.canonical' && \Drupal::routeMatch()->getParameter('oc_actor')->bundle() == 'client' ) {
|
|
||||||
$markup = $this->actorPage();
|
|
||||||
$build = [];
|
|
||||||
$build['contextual_menu'] = [
|
|
||||||
'#markup' => "<div id='opencase_contextual_menu'>$markup</div",
|
|
||||||
'#cache' => ['max-age' => 0]
|
|
||||||
];
|
|
||||||
return $build;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Contextual menu for Actor page
|
|
||||||
* - Links to add activities of various types
|
|
||||||
*/
|
|
||||||
private function actorPage() {
|
|
||||||
$actor_id = \Drupal::routeMatch()->getParameter('oc_actor')->id();
|
|
||||||
return $this->generateLinksForAddingNewActivities("Add activity", $actor_id);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* returns html markup.
|
|
||||||
*/
|
|
||||||
private function generateLinksForAddingNewActivities($title, $actor_id) {
|
|
||||||
$title = t($title);
|
|
||||||
$markup = "<br /><p><strong>$title: </strong>";
|
|
||||||
$allActivityTypes = \Drupal::service('entity_type.bundle.info')->getBundleInfo('oc_activity');
|
|
||||||
$redirect_destination = \Drupal\Core\Url::fromRoute("entity.oc_actor.canonical", ['oc_actor' => $actor_id])->toString();
|
|
||||||
foreach($allActivityTypes as $machine_name => $activityType) {
|
|
||||||
$label = $activityType['label'];
|
|
||||||
$url = \Drupal\Core\Url::fromRoute("entity.oc_activity.add_form", ['oc_activity_type' => $machine_name]);
|
|
||||||
$url->setOption('query', ['actor_id' => $actor_id, 'destination' => $redirect_destination]);
|
|
||||||
$link = \Drupal\Core\Link::fromTextAndUrl($label, $url)->toString();
|
|
||||||
$markup .= " $link";
|
|
||||||
}
|
|
||||||
$markup .= "</p>";
|
|
||||||
return "<div class='openactor_add_links'>$markup</div>";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +1,11 @@
|
|||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies:
|
dependencies:
|
||||||
|
module:
|
||||||
|
- opencase_entities
|
||||||
|
- search_api
|
||||||
config:
|
config:
|
||||||
- search_api.server.opencase_server
|
- search_api.server.opencase_server
|
||||||
module:
|
|
||||||
- search_api
|
|
||||||
- opencase_entities
|
|
||||||
id: opencase_actors
|
id: opencase_actors
|
||||||
name: 'OpenCase Search: Actors'
|
name: 'OpenCase Search: Actors'
|
||||||
description: ''
|
description: ''
|
||||||
@ -16,11 +16,33 @@ field_settings:
|
|||||||
datasource_id: 'entity:oc_actor'
|
datasource_id: 'entity:oc_actor'
|
||||||
property_path: first_name
|
property_path: first_name
|
||||||
type: text
|
type: text
|
||||||
|
dependencies:
|
||||||
|
module:
|
||||||
|
- opencase_entities
|
||||||
|
full_name:
|
||||||
|
label: Name
|
||||||
|
datasource_id: 'entity:oc_actor'
|
||||||
|
property_path: full_name
|
||||||
|
type: text
|
||||||
|
dependencies:
|
||||||
|
module:
|
||||||
|
- opencase_entities
|
||||||
last_name:
|
last_name:
|
||||||
label: 'Last Name'
|
label: 'Last Name'
|
||||||
datasource_id: 'entity:oc_actor'
|
datasource_id: 'entity:oc_actor'
|
||||||
property_path: last_name
|
property_path: last_name
|
||||||
type: text
|
type: text
|
||||||
|
dependencies:
|
||||||
|
module:
|
||||||
|
- opencase_entities
|
||||||
|
name:
|
||||||
|
label: Name
|
||||||
|
datasource_id: 'entity:oc_organisation'
|
||||||
|
property_path: name
|
||||||
|
type: text
|
||||||
|
dependencies:
|
||||||
|
module:
|
||||||
|
- opencase_entities
|
||||||
datasource_settings:
|
datasource_settings:
|
||||||
'entity:oc_actor':
|
'entity:oc_actor':
|
||||||
bundles:
|
bundles:
|
||||||
@ -29,6 +51,13 @@ datasource_settings:
|
|||||||
languages:
|
languages:
|
||||||
default: true
|
default: true
|
||||||
selected: { }
|
selected: { }
|
||||||
|
'entity:oc_organisation':
|
||||||
|
bundles:
|
||||||
|
default: true
|
||||||
|
selected: { }
|
||||||
|
languages:
|
||||||
|
default: true
|
||||||
|
selected: { }
|
||||||
processor_settings:
|
processor_settings:
|
||||||
add_url: { }
|
add_url: { }
|
||||||
aggregated_field: { }
|
aggregated_field: { }
|
||||||
@ -36,10 +65,13 @@ processor_settings:
|
|||||||
all_fields: true
|
all_fields: true
|
||||||
fields:
|
fields:
|
||||||
- first_name
|
- first_name
|
||||||
|
- full_name
|
||||||
- last_name
|
- last_name
|
||||||
|
- name
|
||||||
weights:
|
weights:
|
||||||
preprocess_index: -20
|
preprocess_index: -20
|
||||||
preprocess_query: -20
|
preprocess_query: -20
|
||||||
|
language_with_fallback: { }
|
||||||
rendered_item: { }
|
rendered_item: { }
|
||||||
tracker_settings:
|
tracker_settings:
|
||||||
default:
|
default:
|
||||||
|
@ -14,7 +14,6 @@ description: ''
|
|||||||
tag: ''
|
tag: ''
|
||||||
base_table: search_api_index_opencase_actors
|
base_table: search_api_index_opencase_actors
|
||||||
base_field: search_api_id
|
base_field: search_api_id
|
||||||
core: 8.x
|
|
||||||
display:
|
display:
|
||||||
default:
|
default:
|
||||||
display_plugin: default
|
display_plugin: default
|
||||||
@ -77,17 +76,13 @@ display:
|
|||||||
description: ''
|
description: ''
|
||||||
columns:
|
columns:
|
||||||
name: name
|
name: name
|
||||||
created: created
|
|
||||||
type: type
|
type: type
|
||||||
id: id
|
type_1: type_1
|
||||||
nothing: nothing
|
name_1: name_1
|
||||||
info:
|
info:
|
||||||
name:
|
name:
|
||||||
align: ''
|
sortable: false
|
||||||
separator: ''
|
default_sort_order: asc
|
||||||
empty_column: false
|
|
||||||
responsive: ''
|
|
||||||
created:
|
|
||||||
align: ''
|
align: ''
|
||||||
separator: ''
|
separator: ''
|
||||||
empty_column: false
|
empty_column: false
|
||||||
@ -97,14 +92,12 @@ display:
|
|||||||
separator: ''
|
separator: ''
|
||||||
empty_column: false
|
empty_column: false
|
||||||
responsive: ''
|
responsive: ''
|
||||||
id:
|
type_1:
|
||||||
align: ''
|
align: ''
|
||||||
separator: ''
|
separator: ''
|
||||||
empty_column: false
|
empty_column: false
|
||||||
responsive: ''
|
responsive: ''
|
||||||
nothing:
|
name_1:
|
||||||
sortable: false
|
|
||||||
default_sort_order: asc
|
|
||||||
align: ''
|
align: ''
|
||||||
separator: ''
|
separator: ''
|
||||||
empty_column: false
|
empty_column: false
|
||||||
@ -114,15 +107,15 @@ display:
|
|||||||
row:
|
row:
|
||||||
type: fields
|
type: fields
|
||||||
fields:
|
fields:
|
||||||
first_name:
|
name:
|
||||||
id: first_name
|
id: name
|
||||||
table: search_api_datasource_opencase_actors_entity_oc_actor
|
table: search_api_index_opencase_actors
|
||||||
field: first_name
|
field: name
|
||||||
relationship: none
|
relationship: none
|
||||||
group_type: group
|
group_type: group
|
||||||
admin_label: ''
|
admin_label: ''
|
||||||
label: 'First Name'
|
label: 'Organisation name '
|
||||||
exclude: false
|
exclude: true
|
||||||
alter:
|
alter:
|
||||||
alter_text: false
|
alter_text: false
|
||||||
text: ''
|
text: ''
|
||||||
@ -165,7 +158,7 @@ display:
|
|||||||
click_sort_column: value
|
click_sort_column: value
|
||||||
type: string
|
type: string
|
||||||
settings:
|
settings:
|
||||||
link_to_entity: false
|
link_to_entity: true
|
||||||
group_column: value
|
group_column: value
|
||||||
group_columns: { }
|
group_columns: { }
|
||||||
group_rows: true
|
group_rows: true
|
||||||
@ -183,20 +176,19 @@ display:
|
|||||||
use_highlighting: false
|
use_highlighting: false
|
||||||
multi_type: separator
|
multi_type: separator
|
||||||
multi_separator: ', '
|
multi_separator: ', '
|
||||||
entity_type: oc_actor
|
|
||||||
plugin_id: search_api_field
|
plugin_id: search_api_field
|
||||||
last_name:
|
name_1:
|
||||||
id: last_name
|
id: name_1
|
||||||
table: search_api_datasource_opencase_actors_entity_oc_actor
|
table: search_api_datasource_opencase_actors_entity_oc_actor
|
||||||
field: last_name
|
field: name
|
||||||
relationship: none
|
relationship: none
|
||||||
group_type: group
|
group_type: group
|
||||||
admin_label: ''
|
admin_label: ''
|
||||||
label: 'Last Name'
|
label: Name
|
||||||
exclude: false
|
exclude: false
|
||||||
alter:
|
alter:
|
||||||
alter_text: false
|
alter_text: false
|
||||||
text: ''
|
text: '{{ name_1 }}'
|
||||||
make_link: false
|
make_link: false
|
||||||
path: ''
|
path: ''
|
||||||
absolute: false
|
absolute: false
|
||||||
@ -229,14 +221,14 @@ display:
|
|||||||
element_wrapper_type: ''
|
element_wrapper_type: ''
|
||||||
element_wrapper_class: ''
|
element_wrapper_class: ''
|
||||||
element_default_classes: true
|
element_default_classes: true
|
||||||
empty: ''
|
empty: '{{ name }}'
|
||||||
hide_empty: false
|
hide_empty: false
|
||||||
empty_zero: false
|
empty_zero: false
|
||||||
hide_alter_empty: true
|
hide_alter_empty: true
|
||||||
click_sort_column: value
|
click_sort_column: value
|
||||||
type: string
|
type: string
|
||||||
settings:
|
settings:
|
||||||
link_to_entity: false
|
link_to_entity: true
|
||||||
group_column: value
|
group_column: value
|
||||||
group_columns: { }
|
group_columns: { }
|
||||||
group_rows: true
|
group_rows: true
|
||||||
@ -263,8 +255,8 @@ display:
|
|||||||
relationship: none
|
relationship: none
|
||||||
group_type: group
|
group_type: group
|
||||||
admin_label: ''
|
admin_label: ''
|
||||||
label: Type
|
label: 'Person type'
|
||||||
exclude: false
|
exclude: true
|
||||||
alter:
|
alter:
|
||||||
alter_text: false
|
alter_text: false
|
||||||
text: ''
|
text: ''
|
||||||
@ -330,94 +322,18 @@ display:
|
|||||||
display_method: label
|
display_method: label
|
||||||
entity_type: oc_actor
|
entity_type: oc_actor
|
||||||
plugin_id: search_api_field
|
plugin_id: search_api_field
|
||||||
created:
|
type_1:
|
||||||
id: created
|
id: type_1
|
||||||
table: search_api_datasource_opencase_actors_entity_oc_actor
|
table: search_api_datasource_opencase_actors_entity_oc_organisation
|
||||||
field: created
|
field: type
|
||||||
relationship: none
|
relationship: none
|
||||||
group_type: group
|
group_type: group
|
||||||
admin_label: ''
|
admin_label: ''
|
||||||
label: 'Record created on'
|
label: Type
|
||||||
exclude: false
|
exclude: false
|
||||||
alter:
|
alter:
|
||||||
alter_text: false
|
alter_text: true
|
||||||
text: ''
|
text: '{{ type }}{{ type_1 }}'
|
||||||
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
|
|
||||||
click_sort_column: value
|
|
||||||
type: timestamp
|
|
||||||
settings:
|
|
||||||
date_format: short
|
|
||||||
custom_date_format: ''
|
|
||||||
timezone: ''
|
|
||||||
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
|
|
||||||
field_rendering: true
|
|
||||||
fallback_handler: search_api_date
|
|
||||||
fallback_options:
|
|
||||||
date_format: fallback
|
|
||||||
custom_date_format: ''
|
|
||||||
timezone: ''
|
|
||||||
link_to_item: false
|
|
||||||
use_highlighting: false
|
|
||||||
multi_type: separator
|
|
||||||
multi_separator: ', '
|
|
||||||
entity_type: oc_actor
|
|
||||||
plugin_id: search_api_field
|
|
||||||
id:
|
|
||||||
id: id
|
|
||||||
table: search_api_datasource_opencase_actors_entity_oc_actor
|
|
||||||
field: id
|
|
||||||
relationship: none
|
|
||||||
group_type: group
|
|
||||||
admin_label: ''
|
|
||||||
label: ID
|
|
||||||
exclude: true
|
|
||||||
alter:
|
|
||||||
alter_text: false
|
|
||||||
text: ''
|
|
||||||
make_link: false
|
make_link: false
|
||||||
path: ''
|
path: ''
|
||||||
absolute: false
|
absolute: false
|
||||||
@ -450,16 +366,15 @@ display:
|
|||||||
element_wrapper_type: ''
|
element_wrapper_type: ''
|
||||||
element_wrapper_class: ''
|
element_wrapper_class: ''
|
||||||
element_default_classes: true
|
element_default_classes: true
|
||||||
empty: ''
|
empty: '{{ type }}{{ type_1 }}'
|
||||||
hide_empty: false
|
hide_empty: false
|
||||||
empty_zero: false
|
empty_zero: false
|
||||||
hide_alter_empty: true
|
hide_alter_empty: true
|
||||||
click_sort_column: value
|
click_sort_column: target_id
|
||||||
type: number_integer
|
type: entity_reference_label
|
||||||
settings:
|
settings:
|
||||||
thousand_separator: ''
|
link: false
|
||||||
prefix_suffix: true
|
group_column: target_id
|
||||||
group_column: value
|
|
||||||
group_columns: { }
|
group_columns: { }
|
||||||
group_rows: true
|
group_rows: true
|
||||||
delta_limit: 0
|
delta_limit: 0
|
||||||
@ -470,74 +385,17 @@ display:
|
|||||||
separator: ', '
|
separator: ', '
|
||||||
field_api_classes: false
|
field_api_classes: false
|
||||||
field_rendering: true
|
field_rendering: true
|
||||||
fallback_handler: search_api_numeric
|
fallback_handler: search_api_entity
|
||||||
fallback_options:
|
fallback_options:
|
||||||
set_precision: false
|
|
||||||
precision: 0
|
|
||||||
decimal: .
|
|
||||||
separator: ','
|
|
||||||
format_plural: false
|
|
||||||
format_plural_string: !!binary MQNAY291bnQ=
|
|
||||||
prefix: ''
|
|
||||||
suffix: ''
|
|
||||||
link_to_item: false
|
link_to_item: false
|
||||||
use_highlighting: false
|
use_highlighting: false
|
||||||
multi_type: separator
|
multi_type: separator
|
||||||
multi_separator: ', '
|
multi_separator: ', '
|
||||||
format_plural_values:
|
display_methods:
|
||||||
- '1'
|
oc_organisation_type:
|
||||||
- '@count'
|
display_method: label
|
||||||
entity_type: oc_actor
|
entity_type: oc_organisation
|
||||||
plugin_id: search_api_field
|
plugin_id: search_api_field
|
||||||
nothing:
|
|
||||||
id: nothing
|
|
||||||
table: views
|
|
||||||
field: nothing
|
|
||||||
relationship: none
|
|
||||||
group_type: group
|
|
||||||
admin_label: ''
|
|
||||||
label: 'Go to'
|
|
||||||
exclude: false
|
|
||||||
alter:
|
|
||||||
alter_text: true
|
|
||||||
text: "• <a href='/opencase/oc_actor/{{ id }}/'>Details</a> • <a href='/opencase/oc_actor/{{ id}}/case_list'>Cases</a>\n"
|
|
||||||
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: false
|
|
||||||
plugin_id: custom
|
|
||||||
filters:
|
filters:
|
||||||
search_api_fulltext:
|
search_api_fulltext:
|
||||||
id: search_api_fulltext
|
id: search_api_fulltext
|
||||||
@ -566,6 +424,8 @@ display:
|
|||||||
administrator: '0'
|
administrator: '0'
|
||||||
standard_user: '0'
|
standard_user: '0'
|
||||||
placeholder: ''
|
placeholder: ''
|
||||||
|
operator_limit_selection: false
|
||||||
|
operator_list: { }
|
||||||
is_grouped: false
|
is_grouped: false
|
||||||
group_info:
|
group_info:
|
||||||
label: ''
|
label: ''
|
||||||
@ -611,7 +471,8 @@ display:
|
|||||||
- url
|
- url
|
||||||
- url.query_args
|
- url.query_args
|
||||||
- user.roles
|
- user.roles
|
||||||
tags: { }
|
tags:
|
||||||
|
- 'config:search_api.index.opencase_actors'
|
||||||
page_1:
|
page_1:
|
||||||
display_plugin: page
|
display_plugin: page
|
||||||
id: page_1
|
id: page_1
|
||||||
@ -629,4 +490,5 @@ display:
|
|||||||
- url
|
- url
|
||||||
- url.query_args
|
- url.query_args
|
||||||
- user.roles
|
- user.roles
|
||||||
tags: { }
|
tags:
|
||||||
|
- 'config:search_api.index.opencase_actors'
|
||||||
|
@ -2,11 +2,12 @@ name: 'OpenCase'
|
|||||||
type: module
|
type: module
|
||||||
description: 'Simple Case Management'
|
description: 'Simple Case Management'
|
||||||
core: 8.x
|
core: 8.x
|
||||||
version: 8.x-1.9.8
|
version: 8.x-1.9.9
|
||||||
package: 'OpenCase'
|
package: 'OpenCase'
|
||||||
dependencies:
|
dependencies:
|
||||||
- opencase_entities
|
- opencase_entities
|
||||||
- superfish
|
- superfish
|
||||||
- admin_toolbar
|
- admin_toolbar
|
||||||
|
- views_autosubmit
|
||||||
libraries:
|
libraries:
|
||||||
- opencase/opencase-lib
|
- opencase/opencase-lib
|
||||||
|
@ -23,6 +23,12 @@ opencase.add_events_links:
|
|||||||
deriver: Drupal\opencase\Plugin\Derivative\AddEventsMenuLink
|
deriver: Drupal\opencase\Plugin\Derivative\AddEventsMenuLink
|
||||||
menu_name: opencase
|
menu_name: opencase
|
||||||
parent: opencase.opencase_add_new_things_menu
|
parent: opencase.opencase_add_new_things_menu
|
||||||
|
opencase.add_equal_opps:
|
||||||
|
title: 'Equal Opportunies record'
|
||||||
|
menu_name: opencase
|
||||||
|
url: internal:/opencase/oc_equal_opps/add
|
||||||
|
parent: opencase.opencase_add_new_things_menu
|
||||||
|
weight: 10
|
||||||
opencase.opencase_admin_menu:
|
opencase.opencase_admin_menu:
|
||||||
title: 'Administration'
|
title: 'Administration'
|
||||||
description: 'Management and Configuration'
|
description: 'Management and Configuration'
|
||||||
|
@ -89,6 +89,8 @@ function opencase_uninstall() {
|
|||||||
'block.block.opencase',
|
'block.block.opencase',
|
||||||
'system.menu.opencase',
|
'system.menu.opencase',
|
||||||
'views.view.contact_details_changes',
|
'views.view.contact_details_changes',
|
||||||
|
'views.view.equal_opps_records',
|
||||||
|
'block.block.exposedformequal_opps_recordspage_1',
|
||||||
];
|
];
|
||||||
foreach($configs as $config) {
|
foreach($configs as $config) {
|
||||||
Drupal::configFactory()->getEditable($config)->delete();
|
Drupal::configFactory()->getEditable($config)->delete();
|
||||||
|
@ -45,7 +45,7 @@ class AddActorsMenuLink extends DeriverBase implements ContainerDeriverInterface
|
|||||||
$actorTypes = $this->entityTypeManager->getStorage('oc_actor_type')->loadMultiple();
|
$actorTypes = $this->entityTypeManager->getStorage('oc_actor_type')->loadMultiple();
|
||||||
foreach ($actorTypes as $id => $actorType) {
|
foreach ($actorTypes as $id => $actorType) {
|
||||||
$links[$id] = [
|
$links[$id] = [
|
||||||
'title' => "Add ". $actorType->label(),
|
'title' => $actorType->label(),
|
||||||
'route_name' => "entity.oc_actor.add_form",
|
'route_name' => "entity.oc_actor.add_form",
|
||||||
'route_parameters' => ['oc_actor_type' => $actorType->id()]
|
'route_parameters' => ['oc_actor_type' => $actorType->id()]
|
||||||
] + $base_plugin_definition;
|
] + $base_plugin_definition;
|
||||||
|
@ -45,7 +45,7 @@ class AddEventsMenuLink extends DeriverBase implements ContainerDeriverInterface
|
|||||||
$eventTypes = $this->entityTypeManager->getStorage('oc_event_type')->loadMultiple();
|
$eventTypes = $this->entityTypeManager->getStorage('oc_event_type')->loadMultiple();
|
||||||
foreach ($eventTypes as $id => $eventType) {
|
foreach ($eventTypes as $id => $eventType) {
|
||||||
$links[$id] = [
|
$links[$id] = [
|
||||||
'title' => "Add ". $eventType->label() . " Event",
|
'title' => $eventType->label() . " Event",
|
||||||
'route_name' => "entity.oc_event.add_form",
|
'route_name' => "entity.oc_event.add_form",
|
||||||
'route_parameters' => ['oc_event_type' => $eventType->id()]
|
'route_parameters' => ['oc_event_type' => $eventType->id()]
|
||||||
] + $base_plugin_definition;
|
] + $base_plugin_definition;
|
||||||
|
@ -45,7 +45,7 @@ class AddOrganisationsMenuLink extends DeriverBase implements ContainerDeriverIn
|
|||||||
$organisationTypes = $this->entityTypeManager->getStorage('oc_organisation_type')->loadMultiple();
|
$organisationTypes = $this->entityTypeManager->getStorage('oc_organisation_type')->loadMultiple();
|
||||||
foreach ($organisationTypes as $id => $organisationType) {
|
foreach ($organisationTypes as $id => $organisationType) {
|
||||||
$links[$id] = [
|
$links[$id] = [
|
||||||
'title' => "Add ". $organisationType->label(),
|
'title' => $organisationType->label(),
|
||||||
'route_name' => "entity.oc_organisation.add_form",
|
'route_name' => "entity.oc_organisation.add_form",
|
||||||
'route_parameters' => ['oc_organisation_type' => $organisationType->id()]
|
'route_parameters' => ['oc_organisation_type' => $organisationType->id()]
|
||||||
] + $base_plugin_definition;
|
] + $base_plugin_definition;
|
||||||
|
Reference in New Issue
Block a user