Compare commits

...
This repository has been archived on 2022-07-12. You can view files and clone it, but cannot push or open issues or pull requests.

3 Commits
master ... dev

2 changed files with 20 additions and 22 deletions

View File

@ -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() {
return array(\Drupal::request()->query->get('case_id'));
/* 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'];

View File

@ -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;
}
return $fields;
}
/**