Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
0fe7bac594 | |||
8d345ce1f3 | |||
06b2409c61 |
@ -10,7 +10,6 @@
|
||||
"require": {
|
||||
"composer/installers": "*",
|
||||
"drupal/superfish": "*",
|
||||
"drupal/views_autosubmit": "*",
|
||||
"drupal/smtp": "*",
|
||||
"drupal/paragraphs_collapsible": "*"
|
||||
}
|
||||
|
@ -1,28 +0,0 @@
|
||||
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: { }
|
@ -1,308 +0,0 @@
|
||||
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,26 +1,7 @@
|
||||
/* MOVE THIS INTO MORE!! */
|
||||
.top_ups_bought.add-activity-link {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* */
|
||||
|
||||
body {
|
||||
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 */
|
||||
#edit-password-policy-status {
|
||||
display: none;
|
||||
@ -117,9 +98,7 @@ table.views-table.views-view-table caption {
|
||||
|
||||
/* remove "details" accordion, see https://drupal.stackexchange.com/questions/294312/why-has-this-details-accordion-appeared-in-this-view */
|
||||
.views-table details {
|
||||
display: none;
|
||||
}
|
||||
|
||||
form.oc-organisation-relation-form tr:first-child {
|
||||
display: none;
|
||||
|
||||
}
|
||||
|
@ -23,12 +23,15 @@ function template_preprocess_oc_case(array &$variables) {
|
||||
// Separate the fields into two sections to be displayed in two columns.
|
||||
// Remove the name (title) field as this is displayed anyway.
|
||||
$variables['id'] = $variables['elements']['#oc_case']->get('id')[0]->get('value')->getValue();
|
||||
$variables['eva_fields'] = array(); // if the installation has any "EVA" (embedded view) fields this should catch them.
|
||||
$variables['base_fields'] = array();
|
||||
$variables['other_fields'] = array();
|
||||
foreach (Element::children($variables['elements']) as $key) {
|
||||
$variables['content'][$key] = $variables['elements'][$key];
|
||||
if (in_array($key, ['created', 'changed', 'files', 'actors_involved', 'status', 'user_id'])) {
|
||||
$variables['base_fields'][$key] = $variables['elements'][$key];
|
||||
} else if (strpos($key, "entity_view") !== false) {
|
||||
$variables['eva_fields'][$key] = $variables['elements'][$key];
|
||||
} else {
|
||||
$variables['other_fields'][$key] = $variables['elements'][$key];
|
||||
unset($variables['other_fields']['name']);
|
||||
|
@ -2,10 +2,6 @@ name: 'Opencase Cases'
|
||||
type: module
|
||||
description: 'Provides case entities and a required field on activities linking them to a case.'
|
||||
core: 8.x
|
||||
package: OpenCase
|
||||
package: 'OpenCase'
|
||||
dependencies:
|
||||
0: opencase_entities
|
||||
1: datetime
|
||||
4: options
|
||||
5: paragraphs
|
||||
6: user
|
||||
- opencase_entities
|
||||
|
@ -66,14 +66,13 @@ function opencase_cases_entity_base_field_info($entity_type) {
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* When creating an activity, it sets the case id from the URL.
|
||||
*/
|
||||
function opencase_cases_default_activity_case_value() {
|
||||
/* When creating an activity, it sets the case id from the URL.
|
||||
/*/
|
||||
public static function opencase_cases_default_activity_case_value() {
|
||||
return array(\Drupal::request()->query->get('case_id'));
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Implementation of hook_form_alter()
|
||||
* Changes what page is redirected to after deleting things
|
||||
*/
|
||||
@ -90,14 +89,14 @@ function opencase_cases_form_alter(&$form, &$form_state, $form_id) {
|
||||
|
||||
function _opencase_cases_redirect_to_home($form, &$form_state) {
|
||||
$form_state->setRedirect('<front>');
|
||||
}
|
||||
|
||||
function _opencase_cases_delete_activity_redirect($form, &$form_state) {
|
||||
$case_id = $form_state->getFormObject()->getEntity()->oc_case->target_id;
|
||||
$form_state->setRedirect('entity.oc_case.canonical', ['oc_case' => $case_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_theme_suggestions_HOOK().
|
||||
*/
|
||||
* Implements hook_theme_suggestions_HOOK().
|
||||
*/
|
||||
function opencase_cases_theme_suggestions_oc_case(array $variables) {
|
||||
$suggestions = [];
|
||||
$entity = $variables['elements']['#oc_case'];
|
||||
|
@ -29,5 +29,10 @@
|
||||
{{ field }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="eva_fields">
|
||||
{% for field in eva_fields %}
|
||||
{{ field }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,12 +0,0 @@
|
||||
opencase_entities.oc_organisation_relation_type.*:
|
||||
type: config_entity
|
||||
label: 'Organisation Relation type config'
|
||||
mapping:
|
||||
id:
|
||||
type: string
|
||||
label: 'ID'
|
||||
label:
|
||||
type: label
|
||||
label: 'Label'
|
||||
uuid:
|
||||
type: string
|
@ -1,30 +0,0 @@
|
||||
<?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];
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains oc_organisation_relation.page.inc.
|
||||
*
|
||||
* Page callback for Organisation Relation entities.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Render\Element;
|
||||
|
||||
/**
|
||||
* Prepares variables for Organisation Relation templates.
|
||||
*
|
||||
* Default template: oc_organisation_relation.html.twig.
|
||||
*
|
||||
* @param array $variables
|
||||
* An associative array containing:
|
||||
* - elements: An associative array containing the user information and any
|
||||
* - attributes: HTML attributes for the containing element.
|
||||
*/
|
||||
function template_preprocess_oc_organisation_relation(array &$variables) {
|
||||
// Fetch OCOrganisationRelation Entity Object.
|
||||
$oc_organisation_relation = $variables['elements']['#oc_organisation_relation'];
|
||||
|
||||
// Helpful $content variable for templates.
|
||||
foreach (Element::children($variables['elements']) as $key) {
|
||||
$variables['content'][$key] = $variables['elements'][$key];
|
||||
}
|
||||
}
|
@ -2,75 +2,6 @@
|
||||
|
||||
|
||||
use \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchemaConverter;
|
||||
use \Drupal\Core\Field\BaseFieldDefinition;
|
||||
|
||||
function opencase_entities_update_80202() {
|
||||
\Drupal::entityTypeManager()->clearCachedDefinitions();
|
||||
\Drupal::entityDefinitionUpdateManager()
|
||||
->installEntityType(\Drupal::entityTypeManager()->getDefinition('oc_organisation_relation'));
|
||||
}
|
||||
|
||||
function opencase_entities_update_80201() {
|
||||
$update_manager = \Drupal::entityDefinitionUpdateManager();
|
||||
$definition = $update_manager->getFieldStorageDefinition('phone', 'oc_actor');
|
||||
$update_manager->updateFieldStorageDefinition($definition);
|
||||
$definition = $update_manager->getFieldStorageDefinition('phone2', 'oc_actor');
|
||||
$update_manager->updateFieldStorageDefinition($definition);
|
||||
$definition = $update_manager->getFieldStorageDefinition('postal_address', 'oc_actor');
|
||||
$update_manager->updateFieldStorageDefinition($definition);
|
||||
$definition = $update_manager->getFieldStorageDefinition('email', 'oc_actor');
|
||||
$update_manager->updateFieldStorageDefinition($definition);
|
||||
$definition = $update_manager->getFieldStorageDefinition('post_code', 'oc_actor');
|
||||
$update_manager->updateFieldStorageDefinition($definition);
|
||||
}
|
||||
|
||||
function opencase_entities_update_80200() {
|
||||
$field_storage_definition = BaseFieldDefinition::create('string')
|
||||
->setLabel(t('Website'))
|
||||
->setRevisionable(TRUE)
|
||||
->setSettings([
|
||||
'max_length' => 50,
|
||||
'text_processing' => 0,
|
||||
])
|
||||
->setDefaultValue('')
|
||||
->setDisplayOptions('view', [
|
||||
'label' => 'above',
|
||||
'type' => 'string',
|
||||
'weight' => 49,
|
||||
])
|
||||
->setDisplayOptions('form', [
|
||||
'type' => 'string_textfield',
|
||||
'weight' => 49,
|
||||
])
|
||||
->setRequired(FALSE);
|
||||
|
||||
\Drupal::entityDefinitionUpdateManager()
|
||||
->installFieldStorageDefinition('org_website', 'oc_organisation', 'opencase_entities', $field_storage_definition);
|
||||
}
|
||||
|
||||
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() {
|
||||
$field_storage_definition = \Drupal\Core\Field\BaseFieldDefinition::create('file')
|
||||
|
@ -45,18 +45,3 @@ entity.oc_bank_account.add_form:
|
||||
title: 'Add Bank Account'
|
||||
appears_on:
|
||||
- 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
|
||||
entity.oc_organisation_relation.add_form:
|
||||
route_name: entity.oc_organisation_relation.add_page
|
||||
title: 'Add Organisation Relation'
|
||||
appears_on:
|
||||
- entity.oc_organisation_relation.collection
|
||||
entity.oc_organisation_relation_type.add_form:
|
||||
route_name: entity.oc_organisation_relation_type.add_form
|
||||
title: 'Add Organisation Relation type'
|
||||
appears_on:
|
||||
- entity.oc_organisation_relation_type.collection
|
||||
|
@ -82,34 +82,3 @@ oc_bank_account.admin.structure.settings:
|
||||
description: 'Configure Bank Account entities'
|
||||
route_name: oc_bank_account.settings
|
||||
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
|
||||
|
||||
# Organisation Relation menu items definition
|
||||
entity.oc_organisation_relation.collection:
|
||||
title: 'Organisation Relation list'
|
||||
route_name: entity.oc_organisation_relation.collection
|
||||
description: 'List Organisation Relation entities'
|
||||
parent: system.admin_structure
|
||||
weight: 100
|
||||
|
||||
|
||||
# Organisation Relation type menu items definition
|
||||
entity.oc_organisation_relation_type.collection:
|
||||
title: 'Organisation Relation type'
|
||||
route_name: entity.oc_organisation_relation_type.collection
|
||||
description: 'List Organisation Relation type (bundles)'
|
||||
parent: system.admin_structure
|
||||
weight: 99
|
||||
|
@ -105,41 +105,3 @@ entity.oc_bank_account.delete_form:
|
||||
base_route: entity.oc_bank_account.canonical
|
||||
title: Delete
|
||||
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
|
||||
# Organisation Relation routing definition
|
||||
|
||||
entity.oc_organisation_relation.canonical:
|
||||
route_name: entity.oc_organisation_relation.canonical
|
||||
base_route: entity.oc_organisation_relation.canonical
|
||||
title: 'View'
|
||||
|
||||
entity.oc_organisation_relation.edit_form:
|
||||
route_name: entity.oc_organisation_relation.edit_form
|
||||
base_route: entity.oc_organisation_relation.canonical
|
||||
title: 'Edit'
|
||||
|
||||
entity.oc_organisation_relation.delete_form:
|
||||
route_name: entity.oc_organisation_relation.delete_form
|
||||
base_route: entity.oc_organisation_relation.canonical
|
||||
title: Delete
|
||||
weight: 10
|
||||
|
@ -29,16 +29,6 @@ function opencase_entities_help($route_name, RouteMatchInterface $route_match) {
|
||||
*/
|
||||
function opencase_entities_theme() {
|
||||
$theme = [];
|
||||
$theme['oc_organisation_relation'] = [
|
||||
'render element' => 'elements',
|
||||
'file' => 'oc_organisation_relation.page.inc',
|
||||
'template' => 'oc_organisation_relation',
|
||||
];
|
||||
$theme['oc_organisation_relation_content_add_list'] = [
|
||||
'render element' => 'content',
|
||||
'variables' => ['content' => NULL],
|
||||
'file' => 'oc_organisation_relation.page.inc',
|
||||
];
|
||||
$theme['opencase_entities'] = [
|
||||
'render element' => 'children',
|
||||
];
|
||||
@ -150,19 +140,3 @@ function opencase_entities_theme_suggestions_oc_event(array $variables) {
|
||||
return $suggestions;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_theme_suggestions_HOOK().
|
||||
*/
|
||||
function opencase_entities_theme_suggestions_oc_organisation_relation(array $variables) {
|
||||
$suggestions = [];
|
||||
$entity = $variables['elements']['#oc_organisation_relation'];
|
||||
$sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
|
||||
|
||||
$suggestions[] = 'oc_organisation_relation__' . $sanitized_view_mode;
|
||||
$suggestions[] = 'oc_organisation_relation__' . $entity->bundle();
|
||||
$suggestions[] = 'oc_organisation_relation__' . $entity->bundle() . '__' . $sanitized_view_mode;
|
||||
$suggestions[] = 'oc_organisation_relation__' . $entity->id();
|
||||
$suggestions[] = 'oc_organisation_relation__' . $entity->id() . '__' . $sanitized_view_mode;
|
||||
return $suggestions;
|
||||
}
|
||||
|
@ -157,43 +157,3 @@ view published bank account entities:
|
||||
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'
|
||||
|
||||
add organisation relation entities:
|
||||
title: 'Create new Organisation Relation entities'
|
||||
|
||||
administer organisation relation entities:
|
||||
title: 'Administer Organisation Relation entities'
|
||||
description: 'Allow to access the administration form to configure Organisation Relation entities.'
|
||||
restrict access: true
|
||||
|
||||
delete organisation relation entities:
|
||||
title: 'Delete Organisation Relation entities'
|
||||
|
||||
edit organisation relation entities:
|
||||
title: 'Edit Organisation Relation entities'
|
||||
|
||||
view published organisation relation entities:
|
||||
title: 'View published Organisation Relation entities'
|
||||
|
||||
view unpublished organisation relation entities:
|
||||
title: 'View unpublished Organisation Relation entities'
|
||||
|
||||
|
@ -268,9 +268,8 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
||||
->setDefaultValue('')
|
||||
->setDisplayOptions('form', [
|
||||
'type' => 'string_textfield',
|
||||
'weight' => -100,
|
||||
])
|
||||
->setRequired(TRUE);
|
||||
'weight' => -9,
|
||||
]);
|
||||
|
||||
$fields['middle_names'] = BaseFieldDefinition::create('string')
|
||||
->setLabel(t('Middle Names'))
|
||||
@ -285,7 +284,7 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
||||
->setDefaultValue('')
|
||||
->setDisplayOptions('form', [
|
||||
'type' => 'string_textfield',
|
||||
'weight' => -99,
|
||||
'weight' => -8,
|
||||
])
|
||||
->setRequired(FALSE);
|
||||
|
||||
@ -302,9 +301,8 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
||||
->setDefaultValue('')
|
||||
->setDisplayOptions('form', [
|
||||
'type' => 'string_textfield',
|
||||
'weight' => -98,
|
||||
])
|
||||
->setRequired(TRUE);
|
||||
'weight' => -7,
|
||||
]);
|
||||
|
||||
// Contact details.
|
||||
$fields['email'] = BaseFieldDefinition::create('string')
|
||||
@ -315,8 +313,7 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
||||
'max_length' => 30,
|
||||
'text_processing' => 0,
|
||||
))
|
||||
->setDisplayConfigurable("form", true)
|
||||
->setDisplayConfigurable("view", true)
|
||||
->setDisplayConfigurable('form', true)
|
||||
->setDisplayOptions('view', array(
|
||||
'label' => 'above',
|
||||
'type' => 'string',
|
||||
@ -334,8 +331,6 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
||||
'max_length' => 20,
|
||||
'text_processing' => 0,
|
||||
))
|
||||
->setDisplayConfigurable("form", true)
|
||||
->setDisplayConfigurable("view", true)
|
||||
->setDisplayOptions('view', array(
|
||||
'label' => 'above',
|
||||
'type' => 'string',
|
||||
@ -353,8 +348,6 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
||||
'max_length' => 20,
|
||||
'text_processing' => 0,
|
||||
))
|
||||
->setDisplayConfigurable("form", true)
|
||||
->setDisplayConfigurable("view", true)
|
||||
->setDisplayOptions('view', array(
|
||||
'label' => 'above',
|
||||
'type' => 'string',
|
||||
@ -373,8 +366,6 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
||||
'max_length' => 255,
|
||||
'text_processing' => 0,
|
||||
))
|
||||
->setDisplayConfigurable("form", true)
|
||||
->setDisplayConfigurable("view", true)
|
||||
->setDisplayOptions('view', array(
|
||||
'label' => 'above',
|
||||
'type' => 'basic_string',
|
||||
@ -392,8 +383,6 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
||||
'max_length' => 10,
|
||||
'text_processing' => 0,
|
||||
))
|
||||
->setDisplayConfigurable("form", true)
|
||||
->setDisplayConfigurable("view", true)
|
||||
->setDisplayOptions('view', array(
|
||||
'label' => 'above',
|
||||
'type' => 'string',
|
||||
|
@ -1,260 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
<?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);
|
||||
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
<?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,7 +149,13 @@ class OCEvent extends ContentEntityBase implements OCEventInterface {
|
||||
->setDescription(t('The user ID of author of the Event entity.'))
|
||||
->setRevisionable(TRUE)
|
||||
->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')
|
||||
->setLabel(t('Name'))
|
||||
@ -159,6 +165,11 @@ class OCEvent extends ContentEntityBase implements OCEventInterface {
|
||||
'text_processing' => 0,
|
||||
])
|
||||
->setDefaultValue('')
|
||||
->setDisplayOptions('view', [
|
||||
'label' => 'above',
|
||||
'type' => 'string',
|
||||
'weight' => -4,
|
||||
])
|
||||
->setDisplayOptions('form', [
|
||||
'type' => 'string_textfield',
|
||||
'weight' => -4,
|
||||
|
@ -211,27 +211,9 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
|
||||
'type' => 'string_textarea',
|
||||
'weight' => 50,
|
||||
));
|
||||
$fields['website'] = BaseFieldDefinition::create('string')
|
||||
->setLabel(t('Website'))
|
||||
->setRevisionable(TRUE)
|
||||
->setSettings([
|
||||
'max_length' => 50,
|
||||
'text_processing' => 0,
|
||||
])
|
||||
->setDefaultValue('')
|
||||
->setDisplayOptions('view', [
|
||||
'label' => 'above',
|
||||
'type' => 'string',
|
||||
'weight' => 49,
|
||||
])
|
||||
->setDisplayOptions('form', [
|
||||
'type' => 'string_textfield',
|
||||
'weight' => 49,
|
||||
])
|
||||
->setRequired(FALSE);
|
||||
$fields['contact_name'] = BaseFieldDefinition::create('string')
|
||||
->setLabel(t('Contact Name'))
|
||||
->setDescription(t('Name of the main contact for this organisation.'))
|
||||
->setDescription(t('Name of the main contact for this client.'))
|
||||
->setRevisionable(TRUE)
|
||||
->setSettings([
|
||||
'max_length' => 50,
|
||||
@ -249,25 +231,6 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
|
||||
])
|
||||
->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')
|
||||
->setLabel(t('Email Address'))
|
||||
->setRevisionable(TRUE)
|
||||
|
@ -1,151 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Entity;
|
||||
|
||||
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 Organisation Relation entity.
|
||||
*
|
||||
* @ingroup opencase_entities
|
||||
*
|
||||
* @ContentEntityType(
|
||||
* id = "oc_organisation_relation",
|
||||
* label = @Translation("Organisation Relation"),
|
||||
* bundle_label = @Translation("Organisation Relation type"),
|
||||
* handlers = {
|
||||
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
||||
* "list_builder" = "Drupal\opencase_entities\OCOrganisationRelationListBuilder",
|
||||
* "views_data" = "Drupal\opencase_entities\Entity\OCOrganisationRelationViewsData",
|
||||
*
|
||||
* "form" = {
|
||||
* "default" = "Drupal\opencase_entities\Form\OCOrganisationRelationForm",
|
||||
* "add" = "Drupal\opencase_entities\Form\OCOrganisationRelationForm",
|
||||
* "edit" = "Drupal\opencase_entities\Form\OCOrganisationRelationForm",
|
||||
* "delete" = "Drupal\opencase_entities\Form\OCOrganisationRelationDeleteForm",
|
||||
* },
|
||||
* "route_provider" = {
|
||||
* "html" = "Drupal\opencase_entities\OCOrganisationRelationHtmlRouteProvider",
|
||||
* },
|
||||
* "access" = "Drupal\opencase_entities\OCOrganisationRelationAccessControlHandler",
|
||||
* },
|
||||
* base_table = "oc_organisation_relation",
|
||||
* translatable = FALSE,
|
||||
* admin_permission = "administer organisation relation entities",
|
||||
* entity_keys = {
|
||||
* "id" = "id",
|
||||
* "bundle" = "type",
|
||||
* "label" = "name",
|
||||
* "uuid" = "uuid",
|
||||
* "langcode" = "langcode",
|
||||
* "published" = "status",
|
||||
* },
|
||||
* links = {
|
||||
* "canonical" = "/opencase/oc_organisation_relation/{oc_organisation_relation}",
|
||||
* "add-page" = "/opencase/oc_organisation_relation/add",
|
||||
* "add-form" = "/opencase/oc_organisation_relation/add/{oc_organisation_relation_type}",
|
||||
* "edit-form" = "/opencase/oc_organisation_relation/{oc_organisation_relation}/edit",
|
||||
* "delete-form" = "/opencase/oc_organisation_relation/{oc_organisation_relation}/delete",
|
||||
* "collection" = "/opencase/oc_organisation_relation",
|
||||
* },
|
||||
* bundle_entity_type = "oc_organisation_relation_type",
|
||||
* field_ui_base_route = "entity.oc_organisation_relation_type.edit_form"
|
||||
* )
|
||||
*/
|
||||
class OCOrganisationRelation extends ContentEntityBase implements OCOrganisationRelationInterface {
|
||||
|
||||
use EntityChangedTrait;
|
||||
use EntityPublishedTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->get('name')->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setName($name) {
|
||||
$this->set('name', $name);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCreatedTime() {
|
||||
return $this->get('created')->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setCreatedTime($timestamp) {
|
||||
$this->set('created', $timestamp);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public 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 Organisation Relation entity.'))
|
||||
->setSettings([
|
||||
'max_length' => 50,
|
||||
'text_processing' => 0,
|
||||
])
|
||||
->setDefaultValue('Link between organisations')
|
||||
->setRequired(TRUE);
|
||||
|
||||
$fields['created'] = BaseFieldDefinition::create('created')
|
||||
->setLabel(t('Created'))
|
||||
->setDescription(t('The time that the entity was created.'));
|
||||
|
||||
$fields['changed'] = BaseFieldDefinition::create('changed')
|
||||
->setLabel(t('Changed'))
|
||||
->setDescription(t('The time that the entity was last edited.'));
|
||||
|
||||
$fields['organisations'] = BaseFieldDefinition::create('entity_reference')
|
||||
->setLabel(t('Organisation to Link To'))
|
||||
->setSetting('target_type', 'oc_organisation')
|
||||
->setSetting('handler', 'default')
|
||||
->setCardinality(2)
|
||||
->setDisplayOptions('form', [
|
||||
'label' => 'above',
|
||||
'type' => 'entity_reference_autocomplete',
|
||||
'weight' => -2,
|
||||
'settings' => [
|
||||
'match_operator' => 'CONTAINS',
|
||||
'size' => '60',
|
||||
'autocomplete_type' => 'tags',
|
||||
'placeholder' => '',
|
||||
],
|
||||
])
|
||||
->setDisplayOptions('view', [
|
||||
'label' => 'above',
|
||||
])
|
||||
->setDisplayConfigurable('view', TRUE)
|
||||
->setDisplayConfigurable('form', TRUE)
|
||||
->setDefaultValueCallback('\Drupal\opencase_entities\Entity\OCOrganisationRelation::defaultValueCallback')
|
||||
->setRequired(TRUE);
|
||||
return $fields;
|
||||
}
|
||||
function defaultValueCallback() {
|
||||
return [\Drupal::request()->query->get('organisation_id')];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,58 +0,0 @@
|
||||
<?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 Organisation Relation entities.
|
||||
*
|
||||
* @ingroup opencase_entities
|
||||
*/
|
||||
interface OCOrganisationRelationInterface extends ContentEntityInterface, EntityChangedInterface, EntityPublishedInterface {
|
||||
|
||||
/**
|
||||
* Add get/set methods for your configuration properties here.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the Organisation Relation name.
|
||||
*
|
||||
* @return string
|
||||
* Name of the Organisation Relation.
|
||||
*/
|
||||
public function getName();
|
||||
|
||||
/**
|
||||
* Sets the Organisation Relation name.
|
||||
*
|
||||
* @param string $name
|
||||
* The Organisation Relation name.
|
||||
*
|
||||
* @return \Drupal\opencase_entities\Entity\OCOrganisationRelationInterface
|
||||
* The called Organisation Relation entity.
|
||||
*/
|
||||
public function setName($name);
|
||||
|
||||
/**
|
||||
* Gets the Organisation Relation creation timestamp.
|
||||
*
|
||||
* @return int
|
||||
* Creation timestamp of the Organisation Relation.
|
||||
*/
|
||||
public function getCreatedTime();
|
||||
|
||||
/**
|
||||
* Sets the Organisation Relation creation timestamp.
|
||||
*
|
||||
* @param int $timestamp
|
||||
* The Organisation Relation creation timestamp.
|
||||
*
|
||||
* @return \Drupal\opencase_entities\Entity\OCOrganisationRelationInterface
|
||||
* The called Organisation Relation entity.
|
||||
*/
|
||||
public function setCreatedTime($timestamp);
|
||||
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Entity;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
||||
|
||||
/**
|
||||
* Defines the Organisation Relation type entity.
|
||||
*
|
||||
* @ConfigEntityType(
|
||||
* id = "oc_organisation_relation_type",
|
||||
* label = @Translation("Organisation Relation type"),
|
||||
* handlers = {
|
||||
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
||||
* "list_builder" = "Drupal\opencase_entities\OCOrganisationRelationTypeListBuilder",
|
||||
* "form" = {
|
||||
* "add" = "Drupal\opencase_entities\Form\OCOrganisationRelationTypeForm",
|
||||
* "edit" = "Drupal\opencase_entities\Form\OCOrganisationRelationTypeForm",
|
||||
* "delete" = "Drupal\opencase_entities\Form\OCOrganisationRelationTypeDeleteForm"
|
||||
* },
|
||||
* "route_provider" = {
|
||||
* "html" = "Drupal\opencase_entities\OCOrganisationRelationTypeHtmlRouteProvider",
|
||||
* },
|
||||
* },
|
||||
* config_prefix = "oc_organisation_relation_type",
|
||||
* admin_permission = "administer site configuration",
|
||||
* bundle_of = "oc_organisation_relation",
|
||||
* entity_keys = {
|
||||
* "id" = "id",
|
||||
* "label" = "label",
|
||||
* "uuid" = "uuid"
|
||||
* },
|
||||
* links = {
|
||||
* "canonical" = "/admin/opencase/oc_organisation_relation_type/{oc_organisation_relation_type}",
|
||||
* "add-form" = "/admin/opencase/oc_organisation_relation_type/add",
|
||||
* "edit-form" = "/admin/opencase/oc_organisation_relation_type/{oc_organisation_relation_type}/edit",
|
||||
* "delete-form" = "/admin/opencase/oc_organisation_relation_type/{oc_organisation_relation_type}/delete",
|
||||
* "collection" = "/admin/opencase/oc_organisation_relation_type"
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
class OCOrganisationRelationType extends ConfigEntityBundleBase implements OCOrganisationRelationTypeInterface {
|
||||
|
||||
/**
|
||||
* The Organisation Relation type ID.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* The Organisation Relation type label.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $label;
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Entity;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityInterface;
|
||||
|
||||
/**
|
||||
* Provides an interface for defining Organisation Relation type entities.
|
||||
*/
|
||||
interface OCOrganisationRelationTypeInterface extends ConfigEntityInterface {
|
||||
|
||||
// Add get/set methods for your configuration properties here.
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Entity;
|
||||
|
||||
use Drupal\views\EntityViewsData;
|
||||
|
||||
/**
|
||||
* Provides Views data for Organisation Relation entities.
|
||||
*/
|
||||
class OCOrganisationRelationViewsData extends EntityViewsData {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getViewsData() {
|
||||
$data = parent::getViewsData();
|
||||
|
||||
// Additional information for Views integration, such as table joins, can be
|
||||
// put here.
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?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 {
|
||||
|
||||
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
<?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()]);
|
||||
}
|
||||
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Form;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityDeleteForm;
|
||||
|
||||
/**
|
||||
* Provides a form for deleting Organisation Relation entities.
|
||||
*
|
||||
* @ingroup opencase_entities
|
||||
*/
|
||||
class OCOrganisationRelationDeleteForm extends ContentEntityDeleteForm {
|
||||
|
||||
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Form;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityForm;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Form controller for Organisation Relation edit forms.
|
||||
*
|
||||
* @ingroup opencase_entities
|
||||
*/
|
||||
class OCOrganisationRelationForm 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\OCOrganisationRelation $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 Organisation Relation.', [
|
||||
'%label' => $entity->label(),
|
||||
]));
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->messenger()->addMessage($this->t('Saved the %label Organisation Relation.', [
|
||||
'%label' => $entity->label(),
|
||||
]));
|
||||
}
|
||||
$form_state->setRedirect('entity.oc_organisation_relation.canonical', ['oc_organisation_relation' => $entity->id()]);
|
||||
}
|
||||
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Form;
|
||||
|
||||
use Drupal\Core\Form\FormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
/**
|
||||
* Class OCOrganisationRelationSettingsForm.
|
||||
*
|
||||
* @ingroup opencase_entities
|
||||
*/
|
||||
class OCOrganisationRelationSettingsForm extends FormBase {
|
||||
|
||||
/**
|
||||
* Returns a unique string identifying the form.
|
||||
*
|
||||
* @return string
|
||||
* The unique string identifying the form.
|
||||
*/
|
||||
public function getFormId() {
|
||||
return 'ocorganisationrelation_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 Organisation Relation 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['ocorganisationrelation_settings']['#markup'] = 'Settings form for Organisation Relation entities. Manage field settings here.';
|
||||
return $form;
|
||||
}
|
||||
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Form;
|
||||
|
||||
use Drupal\Core\Entity\EntityConfirmFormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Url;
|
||||
|
||||
/**
|
||||
* Builds the form to delete Organisation Relation type entities.
|
||||
*/
|
||||
class OCOrganisationRelationTypeDeleteForm extends EntityConfirmFormBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getQuestion() {
|
||||
return $this->t('Are you sure you want to delete %name?', ['%name' => $this->entity->label()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCancelUrl() {
|
||||
return new Url('entity.oc_organisation_relation_type.collection');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getConfirmText() {
|
||||
return $this->t('Delete');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, FormStateInterface $form_state) {
|
||||
$this->entity->delete();
|
||||
|
||||
$this->messenger()->addMessage(
|
||||
$this->t('content @type: deleted @label.', [
|
||||
'@type' => $this->entity->bundle(),
|
||||
'@label' => $this->entity->label(),
|
||||
])
|
||||
);
|
||||
|
||||
$form_state->setRedirectUrl($this->getCancelUrl());
|
||||
}
|
||||
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Form;
|
||||
|
||||
use Drupal\Core\Entity\EntityForm;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
/**
|
||||
* Class OCOrganisationRelationTypeForm.
|
||||
*/
|
||||
class OCOrganisationRelationTypeForm extends EntityForm {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function form(array $form, FormStateInterface $form_state) {
|
||||
$form = parent::form($form, $form_state);
|
||||
|
||||
$oc_organisation_relation_type = $this->entity;
|
||||
$form['label'] = [
|
||||
'#type' => 'textfield',
|
||||
'#title' => $this->t('Label'),
|
||||
'#maxlength' => 255,
|
||||
'#default_value' => $oc_organisation_relation_type->label(),
|
||||
'#description' => $this->t("Label for the Organisation Relation type."),
|
||||
'#required' => TRUE,
|
||||
];
|
||||
|
||||
$form['id'] = [
|
||||
'#type' => 'machine_name',
|
||||
'#default_value' => $oc_organisation_relation_type->id(),
|
||||
'#machine_name' => [
|
||||
'exists' => '\Drupal\opencase_entities\Entity\OCOrganisationRelationType::load',
|
||||
],
|
||||
'#disabled' => !$oc_organisation_relation_type->isNew(),
|
||||
];
|
||||
|
||||
/* You will need additional form elements for your custom properties. */
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function save(array $form, FormStateInterface $form_state) {
|
||||
$oc_organisation_relation_type = $this->entity;
|
||||
$status = $oc_organisation_relation_type->save();
|
||||
|
||||
switch ($status) {
|
||||
case SAVED_NEW:
|
||||
$this->messenger()->addMessage($this->t('Created the %label Organisation Relation type.', [
|
||||
'%label' => $oc_organisation_relation_type->label(),
|
||||
]));
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->messenger()->addMessage($this->t('Saved the %label Organisation Relation type.', [
|
||||
'%label' => $oc_organisation_relation_type->label(),
|
||||
]));
|
||||
}
|
||||
$form_state->setRedirectUrl($oc_organisation_relation_type->toUrl('collection'));
|
||||
}
|
||||
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
<?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');
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
<?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 Organisation Relation entity.
|
||||
*
|
||||
* @see \Drupal\opencase_entities\Entity\OCOrganisationRelation.
|
||||
*/
|
||||
class OCOrganisationRelationAccessControlHandler extends EntityAccessControlHandler {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
|
||||
/** @var \Drupal\opencase_entities\Entity\OCOrganisationRelationInterface $entity */
|
||||
|
||||
switch ($operation) {
|
||||
|
||||
case 'view':
|
||||
|
||||
if (!$entity->isPublished()) {
|
||||
return AccessResult::allowedIfHasPermission($account, 'view unpublished organisation relation entities');
|
||||
}
|
||||
|
||||
|
||||
return AccessResult::allowedIfHasPermission($account, 'view published organisation relation entities');
|
||||
|
||||
case 'update':
|
||||
|
||||
return AccessResult::allowedIfHasPermission($account, 'edit organisation relation entities');
|
||||
|
||||
case 'delete':
|
||||
|
||||
return AccessResult::allowedIfHasPermission($account, 'delete organisation relation entities');
|
||||
}
|
||||
|
||||
// Unknown operation, no opinion.
|
||||
return AccessResult::neutral();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
|
||||
return AccessResult::allowedIfHasPermission($account, 'add organisation relation entities');
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities;
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
|
||||
use Symfony\Component\Routing\Route;
|
||||
|
||||
/**
|
||||
* Provides routes for Organisation Relation entities.
|
||||
*
|
||||
* @see \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
|
||||
* @see \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider
|
||||
*/
|
||||
class OCOrganisationRelationHtmlRouteProvider 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\OCOrganisationRelationSettingsForm',
|
||||
'_title' => "{$entity_type->getLabel()} settings",
|
||||
])
|
||||
->setRequirement('_permission', $entity_type->getAdminPermission())
|
||||
->setOption('_admin_route', TRUE);
|
||||
|
||||
return $route;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
<?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 Organisation Relation entities.
|
||||
*
|
||||
* @ingroup opencase_entities
|
||||
*/
|
||||
class OCOrganisationRelationListBuilder extends EntityListBuilder {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildHeader() {
|
||||
$header['id'] = $this->t('Organisation Relation ID');
|
||||
$header['name'] = $this->t('Name');
|
||||
return $header + parent::buildHeader();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildRow(EntityInterface $entity) {
|
||||
/* @var \Drupal\opencase_entities\Entity\OCOrganisationRelation $entity */
|
||||
$row['id'] = $entity->id();
|
||||
$row['name'] = Link::createFromRoute(
|
||||
$entity->label(),
|
||||
'entity.oc_organisation_relation.edit_form',
|
||||
['oc_organisation_relation' => $entity->id()]
|
||||
);
|
||||
return $row + parent::buildRow($entity);
|
||||
}
|
||||
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities;
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
|
||||
|
||||
/**
|
||||
* Provides routes for Organisation Relation type entities.
|
||||
*
|
||||
* @see Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
|
||||
* @see Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider
|
||||
*/
|
||||
class OCOrganisationRelationTypeHtmlRouteProvider extends AdminHtmlRouteProvider {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRoutes(EntityTypeInterface $entity_type) {
|
||||
$collection = parent::getRoutes($entity_type);
|
||||
|
||||
// Provide your custom entity routes here.
|
||||
return $collection;
|
||||
}
|
||||
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
|
||||
/**
|
||||
* Provides a listing of Organisation Relation type entities.
|
||||
*/
|
||||
class OCOrganisationRelationTypeListBuilder extends ConfigEntityListBuilder {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildHeader() {
|
||||
$header['label'] = $this->t('Organisation Relation type');
|
||||
$header['id'] = $this->t('Machine name');
|
||||
return $header + parent::buildHeader();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildRow(EntityInterface $entity) {
|
||||
$row['label'] = $entity->label();
|
||||
$row['id'] = $entity->id();
|
||||
// You probably want a few more properties here...
|
||||
return $row + parent::buildRow($entity);
|
||||
}
|
||||
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
{#
|
||||
/**
|
||||
* @file
|
||||
* Default theme implementation to present a list of custom content entity types/bundles.
|
||||
*
|
||||
* Available variables:
|
||||
* - types: A collection of all the available custom entity types/bundles.
|
||||
* Each type/bundle contains the following:
|
||||
* - link: A link to add a content entity of this type.
|
||||
* - description: A description of this content entity types/bundle.
|
||||
*
|
||||
* @see template_preprocess_oc_organisation_relation_content_add_list()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
#}
|
||||
{% spaceless %}
|
||||
<dl>
|
||||
{% for type in types %}
|
||||
<dt>{{ type.link }}</dt>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
{% endspaceless %}
|
@ -1,22 +0,0 @@
|
||||
{#
|
||||
/**
|
||||
* @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>
|
@ -1,22 +0,0 @@
|
||||
{#
|
||||
/**
|
||||
* @file oc_organisation_relation.html.twig
|
||||
* Default theme implementation to present Organisation Relation data.
|
||||
*
|
||||
* This template is used when viewing Organisation Relation 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_organisation_relation()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
#}
|
||||
<div{{ attributes.addClass('oc_organisation_relation') }}>
|
||||
{% if content %}
|
||||
{{- content -}}
|
||||
{% endif %}
|
||||
</div>
|
@ -26,7 +26,6 @@ function opencase_no_cases_help($route_name, RouteMatchInterface $route_match) {
|
||||
|
||||
function opencase_no_cases_entity_base_field_info($entity_type) {
|
||||
if ($entity_type->id() === 'oc_activity') {
|
||||
$fields = array();
|
||||
$fields['actors_involved'] = BaseFieldDefinition::create('entity_reference')
|
||||
->setLabel(t('Participants'))
|
||||
->setDescription(t('People involved in this activity. To add one, start typing their name.'))
|
||||
@ -51,8 +50,8 @@ function opencase_no_cases_entity_base_field_info($entity_type) {
|
||||
])
|
||||
->setDefaultValueCallback('opencase_no_cases_actors_involved_callback')
|
||||
->setRequired(TRUE);
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,65 @@
|
||||
<?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
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- opencase_entities
|
||||
- search_api
|
||||
config:
|
||||
- search_api.server.opencase_server
|
||||
module:
|
||||
- search_api
|
||||
- opencase_entities
|
||||
id: opencase_actors
|
||||
name: 'OpenCase Search: Actors'
|
||||
description: ''
|
||||
@ -16,33 +16,11 @@ field_settings:
|
||||
datasource_id: 'entity:oc_actor'
|
||||
property_path: first_name
|
||||
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:
|
||||
label: 'Last Name'
|
||||
datasource_id: 'entity:oc_actor'
|
||||
property_path: last_name
|
||||
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:
|
||||
'entity:oc_actor':
|
||||
bundles:
|
||||
@ -51,13 +29,6 @@ datasource_settings:
|
||||
languages:
|
||||
default: true
|
||||
selected: { }
|
||||
'entity:oc_organisation':
|
||||
bundles:
|
||||
default: true
|
||||
selected: { }
|
||||
languages:
|
||||
default: true
|
||||
selected: { }
|
||||
processor_settings:
|
||||
add_url: { }
|
||||
aggregated_field: { }
|
||||
@ -65,13 +36,10 @@ processor_settings:
|
||||
all_fields: true
|
||||
fields:
|
||||
- first_name
|
||||
- full_name
|
||||
- last_name
|
||||
- name
|
||||
weights:
|
||||
preprocess_index: -20
|
||||
preprocess_query: -20
|
||||
language_with_fallback: { }
|
||||
rendered_item: { }
|
||||
tracker_settings:
|
||||
default:
|
||||
|
@ -14,6 +14,7 @@ description: ''
|
||||
tag: ''
|
||||
base_table: search_api_index_opencase_actors
|
||||
base_field: search_api_id
|
||||
core: 8.x
|
||||
display:
|
||||
default:
|
||||
display_plugin: default
|
||||
@ -76,13 +77,17 @@ display:
|
||||
description: ''
|
||||
columns:
|
||||
name: name
|
||||
created: created
|
||||
type: type
|
||||
type_1: type_1
|
||||
name_1: name_1
|
||||
id: id
|
||||
nothing: nothing
|
||||
info:
|
||||
name:
|
||||
sortable: false
|
||||
default_sort_order: asc
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: ''
|
||||
created:
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
@ -92,12 +97,14 @@ display:
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: ''
|
||||
type_1:
|
||||
id:
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: ''
|
||||
name_1:
|
||||
nothing:
|
||||
sortable: false
|
||||
default_sort_order: asc
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
@ -107,15 +114,15 @@ display:
|
||||
row:
|
||||
type: fields
|
||||
fields:
|
||||
name:
|
||||
id: name
|
||||
table: search_api_index_opencase_actors
|
||||
field: name
|
||||
first_name:
|
||||
id: first_name
|
||||
table: search_api_datasource_opencase_actors_entity_oc_actor
|
||||
field: first_name
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: 'Organisation name '
|
||||
exclude: true
|
||||
label: 'First Name'
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
@ -158,7 +165,7 @@ display:
|
||||
click_sort_column: value
|
||||
type: string
|
||||
settings:
|
||||
link_to_entity: true
|
||||
link_to_entity: false
|
||||
group_column: value
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
@ -176,19 +183,20 @@ display:
|
||||
use_highlighting: false
|
||||
multi_type: separator
|
||||
multi_separator: ', '
|
||||
entity_type: oc_actor
|
||||
plugin_id: search_api_field
|
||||
name_1:
|
||||
id: name_1
|
||||
last_name:
|
||||
id: last_name
|
||||
table: search_api_datasource_opencase_actors_entity_oc_actor
|
||||
field: name
|
||||
field: last_name
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: Name
|
||||
label: 'Last Name'
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: '{{ name_1 }}'
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
@ -221,14 +229,14 @@ display:
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: '{{ name }}'
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
click_sort_column: value
|
||||
type: string
|
||||
settings:
|
||||
link_to_entity: true
|
||||
link_to_entity: false
|
||||
group_column: value
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
@ -255,8 +263,8 @@ display:
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: 'Person type'
|
||||
exclude: true
|
||||
label: Type
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
@ -322,18 +330,94 @@ display:
|
||||
display_method: label
|
||||
entity_type: oc_actor
|
||||
plugin_id: search_api_field
|
||||
type_1:
|
||||
id: type_1
|
||||
table: search_api_datasource_opencase_actors_entity_oc_organisation
|
||||
field: type
|
||||
created:
|
||||
id: created
|
||||
table: search_api_datasource_opencase_actors_entity_oc_actor
|
||||
field: created
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: Type
|
||||
label: 'Record created on'
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: true
|
||||
text: '{{ type }}{{ type_1 }}'
|
||||
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: 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
|
||||
path: ''
|
||||
absolute: false
|
||||
@ -366,15 +450,16 @@ display:
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: '{{ type }}{{ type_1 }}'
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
click_sort_column: target_id
|
||||
type: entity_reference_label
|
||||
click_sort_column: value
|
||||
type: number_integer
|
||||
settings:
|
||||
link: false
|
||||
group_column: target_id
|
||||
thousand_separator: ''
|
||||
prefix_suffix: true
|
||||
group_column: value
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
delta_limit: 0
|
||||
@ -385,17 +470,74 @@ display:
|
||||
separator: ', '
|
||||
field_api_classes: false
|
||||
field_rendering: true
|
||||
fallback_handler: search_api_entity
|
||||
fallback_handler: search_api_numeric
|
||||
fallback_options:
|
||||
set_precision: false
|
||||
precision: 0
|
||||
decimal: .
|
||||
separator: ','
|
||||
format_plural: false
|
||||
format_plural_string: !!binary MQNAY291bnQ=
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
link_to_item: false
|
||||
use_highlighting: false
|
||||
multi_type: separator
|
||||
multi_separator: ', '
|
||||
display_methods:
|
||||
oc_organisation_type:
|
||||
display_method: label
|
||||
entity_type: oc_organisation
|
||||
format_plural_values:
|
||||
- '1'
|
||||
- '@count'
|
||||
entity_type: oc_actor
|
||||
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:
|
||||
search_api_fulltext:
|
||||
id: search_api_fulltext
|
||||
@ -424,8 +566,6 @@ display:
|
||||
administrator: '0'
|
||||
standard_user: '0'
|
||||
placeholder: ''
|
||||
operator_limit_selection: false
|
||||
operator_list: { }
|
||||
is_grouped: false
|
||||
group_info:
|
||||
label: ''
|
||||
@ -471,8 +611,7 @@ display:
|
||||
- url
|
||||
- url.query_args
|
||||
- user.roles
|
||||
tags:
|
||||
- 'config:search_api.index.opencase_actors'
|
||||
tags: { }
|
||||
page_1:
|
||||
display_plugin: page
|
||||
id: page_1
|
||||
@ -490,5 +629,4 @@ display:
|
||||
- url
|
||||
- url.query_args
|
||||
- user.roles
|
||||
tags:
|
||||
- 'config:search_api.index.opencase_actors'
|
||||
tags: { }
|
||||
|
@ -2,12 +2,11 @@ name: 'OpenCase'
|
||||
type: module
|
||||
description: 'Simple Case Management'
|
||||
core: 8.x
|
||||
version: 8.x-2.0.2
|
||||
version: 8.x-1.9.8
|
||||
package: 'OpenCase'
|
||||
dependencies:
|
||||
- opencase_entities
|
||||
- superfish
|
||||
- admin_toolbar
|
||||
- views_autosubmit
|
||||
libraries:
|
||||
- opencase/opencase-lib
|
||||
|
@ -23,12 +23,6 @@ opencase.add_events_links:
|
||||
deriver: Drupal\opencase\Plugin\Derivative\AddEventsMenuLink
|
||||
menu_name: opencase
|
||||
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:
|
||||
title: 'Administration'
|
||||
description: 'Management and Configuration'
|
||||
|
@ -89,8 +89,6 @@ function opencase_uninstall() {
|
||||
'block.block.opencase',
|
||||
'system.menu.opencase',
|
||||
'views.view.contact_details_changes',
|
||||
'views.view.equal_opps_records',
|
||||
'block.block.exposedformequal_opps_recordspage_1',
|
||||
];
|
||||
foreach($configs as $config) {
|
||||
Drupal::configFactory()->getEditable($config)->delete();
|
||||
@ -114,18 +112,3 @@ function opencase_entity_field_access($operation, \Drupal\Core\Field\FieldDefini
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of hook_form_alter()
|
||||
* Changes what page is redirected to after adding or deleting linked organisation
|
||||
*/
|
||||
function opencase_form_alter(&$form, &$form_state, $form_id) {
|
||||
if (preg_match('/oc_organisation_relation_.*_delete_form/', $form_id) or (preg_match('/oc_organisation_relation_.*_add_form/', $form_id))) {
|
||||
$form['actions']['submit']['#submit'][] = '_opencase_organisation_relation_redirect';
|
||||
// $form['actions']['cancel']['#url'] = $form_state->getFormObject()->getEntity()->toUrl();
|
||||
}
|
||||
}
|
||||
|
||||
function _opencase_organisation_relation_redirect($form, &$form_state) {
|
||||
$organisation_id = \Drupal::request()->query->get('organisation_id');
|
||||
$form_state->setRedirect('entity.oc_organisation.canonical', ['oc_organisation' => $organisation_id]);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ class AddActorsMenuLink extends DeriverBase implements ContainerDeriverInterface
|
||||
$actorTypes = $this->entityTypeManager->getStorage('oc_actor_type')->loadMultiple();
|
||||
foreach ($actorTypes as $id => $actorType) {
|
||||
$links[$id] = [
|
||||
'title' => $actorType->label(),
|
||||
'title' => "Add ". $actorType->label(),
|
||||
'route_name' => "entity.oc_actor.add_form",
|
||||
'route_parameters' => ['oc_actor_type' => $actorType->id()]
|
||||
] + $base_plugin_definition;
|
||||
|
@ -45,7 +45,7 @@ class AddEventsMenuLink extends DeriverBase implements ContainerDeriverInterface
|
||||
$eventTypes = $this->entityTypeManager->getStorage('oc_event_type')->loadMultiple();
|
||||
foreach ($eventTypes as $id => $eventType) {
|
||||
$links[$id] = [
|
||||
'title' => $eventType->label() . " Event",
|
||||
'title' => "Add ". $eventType->label() . " Event",
|
||||
'route_name' => "entity.oc_event.add_form",
|
||||
'route_parameters' => ['oc_event_type' => $eventType->id()]
|
||||
] + $base_plugin_definition;
|
||||
|
@ -45,7 +45,7 @@ class AddOrganisationsMenuLink extends DeriverBase implements ContainerDeriverIn
|
||||
$organisationTypes = $this->entityTypeManager->getStorage('oc_organisation_type')->loadMultiple();
|
||||
foreach ($organisationTypes as $id => $organisationType) {
|
||||
$links[$id] = [
|
||||
'title' => $organisationType->label(),
|
||||
'title' => "Add ". $organisationType->label(),
|
||||
'route_name' => "entity.oc_organisation.add_form",
|
||||
'route_parameters' => ['oc_organisation_type' => $organisationType->id()]
|
||||
] + $base_plugin_definition;
|
||||
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceLabelFormatter;
|
||||
|
||||
/**
|
||||
* Plugin implementation of the 'entity reference label delta' formatter.
|
||||
*
|
||||
* @FieldFormatter(
|
||||
* id = "entity_reference_current_target_excluder",
|
||||
* label = @Translation("Exclude current entity from list (ONLY WORKS WITH ORGS FOR NOW)"),
|
||||
* description = @Translation("Don't show the referenced entity if it is the entity being currently viewed"),
|
||||
* field_types = {
|
||||
* "entity_reference"
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
class EntityReferenceCurrentTargetExcluder extends EntityReferenceLabelFormatter {
|
||||
|
||||
// Remove the item which matches the organisation being currently viewed.
|
||||
public function viewElements(\Drupal\Core\Field\FieldItemListInterface $items, $langcode) {
|
||||
foreach($items as $delta=>$item) {
|
||||
$current_org = \Drupal::routeMatch()->getParameter('oc_organisation')->id();
|
||||
$item_target_id = $item->get('target_id')->getValue();
|
||||
\Drupal::logger("foo")->error($current_org . " " . $item_target_id);
|
||||
if ($current_org == $item_target_id) {
|
||||
$items->removeItem($delta);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$elements = parent::viewElements($items, $langcode);
|
||||
return $elements;
|
||||
}
|
||||
//
|
||||
}
|
Reference in New Issue
Block a user