From c65012315d9a168958add71e38ebb80d62831baa Mon Sep 17 00:00:00 2001 From: dh_6sdxgm Date: Sun, 14 Feb 2021 13:18:36 -0800 Subject: [PATCH 1/4] css --- css/opencase.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/opencase.css b/css/opencase.css index a165884..4e31ef7 100644 --- a/css/opencase.css +++ b/css/opencase.css @@ -20,7 +20,7 @@ div[data-drupal-selector=edit-user-bulk-form] { } /* Free the people from the tyranny of the useless search button */ -#edit-submit-actor-search{ +#edit-submit-actor-search, #edit-submit-actor-search--2{ display: none; } From bc98ecb541b3053119d54822ddaee37f90163241 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 18 Feb 2021 12:02:25 +0000 Subject: [PATCH 2/4] fixed some issues caused by c&ping from opencase_entities --- .../config/schema/oc_case_type.schema.yml | 2 +- .../opencase_cases/opencase_cases.info.yml | 2 +- modules/opencase_cases/opencase_cases.module | 7 +++--- .../opencase_cases/src/CaseInvolvement.php | 2 +- .../src/Controller/OCCaseController.php | 8 +++---- modules/opencase_cases/src/Entity/OCCase.php | 24 +++++++++---------- .../src/Entity/OCCaseInterface.php | 14 +++++------ .../opencase_cases/src/Entity/OCCaseType.php | 14 +++++------ .../src/Entity/OCCaseTypeInterface.php | 2 +- .../src/Entity/OCCaseViewsData.php | 2 +- .../src/Form/OCCaseDeleteForm.php | 4 ++-- .../opencase_cases/src/Form/OCCaseForm.php | 6 ++--- .../src/Form/OCCaseRevisionDeleteForm.php | 6 ++--- .../src/Form/OCCaseRevisionRevertForm.php | 12 +++++----- .../OCCaseRevisionRevertTranslationForm.php | 8 +++---- .../src/Form/OCCaseSettingsForm.php | 4 ++-- .../src/Form/OCCaseTypeDeleteForm.php | 2 +- .../src/Form/OCCaseTypeForm.php | 4 ++-- .../src/OCCaseAccessControlHandler.php | 8 +++---- .../src/OCCaseHtmlRouteProvider.php | 16 ++++++------- .../opencase_cases/src/OCCaseListBuilder.php | 6 ++--- modules/opencase_cases/src/OCCaseStorage.php | 6 ++--- .../src/OCCaseStorageInterface.php | 10 ++++---- .../src/OCCaseTranslationHandler.php | 2 +- .../src/OCCaseTypeAccessControlHandler.php | 4 ++-- .../src/OCCaseTypeHtmlRouteProvider.php | 2 +- .../src/OCCaseTypeListBuilder.php | 2 +- 27 files changed, 89 insertions(+), 90 deletions(-) diff --git a/modules/opencase_cases/config/schema/oc_case_type.schema.yml b/modules/opencase_cases/config/schema/oc_case_type.schema.yml index 7c64e98..61e8a19 100644 --- a/modules/opencase_cases/config/schema/oc_case_type.schema.yml +++ b/modules/opencase_cases/config/schema/oc_case_type.schema.yml @@ -1,4 +1,4 @@ -opencase_entities.oc_case_type.*: +opencase_cases.oc_case_type.*: type: config_entity label: 'Case type config' mapping: diff --git a/modules/opencase_cases/opencase_cases.info.yml b/modules/opencase_cases/opencase_cases.info.yml index 945069d..ec9d37f 100644 --- a/modules/opencase_cases/opencase_cases.info.yml +++ b/modules/opencase_cases/opencase_cases.info.yml @@ -4,4 +4,4 @@ description: 'Provides case entities and a required field on activities linking core: 8.x package: 'OpenCase' dependencies: - - opencase_entities + - opencase_cases diff --git a/modules/opencase_cases/opencase_cases.module b/modules/opencase_cases/opencase_cases.module index 8994127..f218d80 100644 --- a/modules/opencase_cases/opencase_cases.module +++ b/modules/opencase_cases/opencase_cases.module @@ -35,14 +35,13 @@ function opencase_cases_theme() { 'render element' => 'elements', 'file' => 'oc_case.page.inc', 'template' => 'oc_case', - ] + ], 'oc_case_content_add_list' => [ 'render element' => 'content', 'variables' => ['content' => NULL], 'file' => 'oc_case.page.inc', ] ]; - ]; } function opencase_cases_entity_base_field_info($entity_type) { @@ -50,7 +49,7 @@ function opencase_cases_entity_base_field_info($entity_type) { // Add Case field to Activity if ($entity_type->id() === 'oc_activity') { - $fields['oc_case'] = BaseFieldDefinition::create('entity_reference') + $fields['oc_case'] = \Drupal\Core\Field\BaseFieldDefinition::create('entity_reference') ->setLabel(t('Case')) ->setDescription(t('The case this activity belongs to.')) ->setSetting('target_type', 'oc_case') @@ -70,7 +69,7 @@ function opencase_cases_entity_base_field_info($entity_type) { /** * When creating an activity, it sets the case id from the URL. */ -public static function opencase_cases_default_activity_case_value() { +function opencase_cases_default_activity_case_value() { return array(\Drupal::request()->query->get('case_id')); } diff --git a/modules/opencase_cases/src/CaseInvolvement.php b/modules/opencase_cases/src/CaseInvolvement.php index 525f4dc..c14aa66 100644 --- a/modules/opencase_cases/src/CaseInvolvement.php +++ b/modules/opencase_cases/src/CaseInvolvement.php @@ -1,6 +1,6 @@ loadRevision($vid); // Only show revisions that are affected by the language that is being // displayed. diff --git a/modules/opencase_cases/src/Entity/OCCase.php b/modules/opencase_cases/src/Entity/OCCase.php index 78856b3..2fb2a83 100644 --- a/modules/opencase_cases/src/Entity/OCCase.php +++ b/modules/opencase_cases/src/Entity/OCCase.php @@ -1,6 +1,6 @@ entity->isNew()) { diff --git a/modules/opencase_cases/src/Form/OCCaseRevisionDeleteForm.php b/modules/opencase_cases/src/Form/OCCaseRevisionDeleteForm.php index f3de820..b4a6039 100644 --- a/modules/opencase_cases/src/Form/OCCaseRevisionDeleteForm.php +++ b/modules/opencase_cases/src/Form/OCCaseRevisionDeleteForm.php @@ -1,6 +1,6 @@ getValue('revert_untranslated_fields'); - /** @var \Drupal\opencase_entities\Entity\OCCaseInterface $default_revision */ + /** @var \Drupal\opencase_cases\Entity\OCCaseInterface $default_revision */ $latest_revision = $this->OCCaseStorage->load($revision->id()); $latest_revision_translation = $latest_revision->getTranslation($this->langcode); diff --git a/modules/opencase_cases/src/Form/OCCaseSettingsForm.php b/modules/opencase_cases/src/Form/OCCaseSettingsForm.php index 217ed23..79bbf9f 100644 --- a/modules/opencase_cases/src/Form/OCCaseSettingsForm.php +++ b/modules/opencase_cases/src/Form/OCCaseSettingsForm.php @@ -1,6 +1,6 @@ 'machine_name', '#default_value' => $oc_case_type->id(), '#machine_name' => [ - 'exists' => '\Drupal\opencase_entities\Entity\OCCaseType::load', + 'exists' => '\Drupal\opencase_cases\Entity\OCCaseType::load', ], '#disabled' => !$oc_case_type->isNew(), ]; diff --git a/modules/opencase_cases/src/OCCaseAccessControlHandler.php b/modules/opencase_cases/src/OCCaseAccessControlHandler.php index f349de9..1fe2bda 100644 --- a/modules/opencase_cases/src/OCCaseAccessControlHandler.php +++ b/modules/opencase_cases/src/OCCaseAccessControlHandler.php @@ -1,17 +1,17 @@ isPublished()) { diff --git a/modules/opencase_cases/src/OCCaseHtmlRouteProvider.php b/modules/opencase_cases/src/OCCaseHtmlRouteProvider.php index a039952..2ae1795 100644 --- a/modules/opencase_cases/src/OCCaseHtmlRouteProvider.php +++ b/modules/opencase_cases/src/OCCaseHtmlRouteProvider.php @@ -1,6 +1,6 @@ setDefaults([ '_title' => "{$entity_type->getLabel()} revisions", - '_controller' => '\Drupal\opencase_entities\Controller\OCCaseController::revisionOverview', + '_controller' => '\Drupal\opencase_cases\Controller\OCCaseController::revisionOverview', ]) ->setRequirement('_permission', 'access case revisions') ->setOption('_admin_route', TRUE); @@ -87,8 +87,8 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider { $route = new Route($entity_type->getLinkTemplate('revision')); $route ->setDefaults([ - '_controller' => '\Drupal\opencase_entities\Controller\OCCaseController::revisionShow', - '_title_callback' => '\Drupal\opencase_entities\Controller\OCCaseController::revisionPageTitle', + '_controller' => '\Drupal\opencase_cases\Controller\OCCaseController::revisionShow', + '_title_callback' => '\Drupal\opencase_cases\Controller\OCCaseController::revisionPageTitle', ]) ->setRequirement('_permission', 'access case revisions') ->setOption('_admin_route', TRUE); @@ -111,7 +111,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider { $route = new Route($entity_type->getLinkTemplate('revision_revert')); $route ->setDefaults([ - '_form' => '\Drupal\opencase_entities\Form\OCCaseRevisionRevertForm', + '_form' => '\Drupal\opencase_cases\Form\OCCaseRevisionRevertForm', '_title' => 'Revert to earlier revision', ]) ->setRequirement('_permission', 'revert all case revisions') @@ -135,7 +135,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider { $route = new Route($entity_type->getLinkTemplate('revision_delete')); $route ->setDefaults([ - '_form' => '\Drupal\opencase_entities\Form\OCCaseRevisionDeleteForm', + '_form' => '\Drupal\opencase_cases\Form\OCCaseRevisionDeleteForm', '_title' => 'Delete earlier revision', ]) ->setRequirement('_permission', 'delete all case revisions') @@ -159,7 +159,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider { $route = new Route($entity_type->getLinkTemplate('translation_revert')); $route ->setDefaults([ - '_form' => '\Drupal\opencase_entities\Form\OCCaseRevisionRevertTranslationForm', + '_form' => '\Drupal\opencase_cases\Form\OCCaseRevisionRevertTranslationForm', '_title' => 'Revert to earlier revision of a translation', ]) ->setRequirement('_permission', 'revert all case revisions') @@ -183,7 +183,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider { $route = new Route("/admin/structure/{$entity_type->id()}/settings"); $route ->setDefaults([ - '_form' => 'Drupal\opencase_entities\Form\OCCaseSettingsForm', + '_form' => 'Drupal\opencase_cases\Form\OCCaseSettingsForm', '_title' => "{$entity_type->getLabel()} settings", ]) ->setRequirement('_permission', $entity_type->getAdminPermission()) diff --git a/modules/opencase_cases/src/OCCaseListBuilder.php b/modules/opencase_cases/src/OCCaseListBuilder.php index 0ab0404..46a70b6 100644 --- a/modules/opencase_cases/src/OCCaseListBuilder.php +++ b/modules/opencase_cases/src/OCCaseListBuilder.php @@ -1,6 +1,6 @@ id(); $row['name'] = Link::createFromRoute( $entity->label(), diff --git a/modules/opencase_cases/src/OCCaseStorage.php b/modules/opencase_cases/src/OCCaseStorage.php index 8f7e2eb..4100878 100644 --- a/modules/opencase_cases/src/OCCaseStorage.php +++ b/modules/opencase_cases/src/OCCaseStorage.php @@ -1,11 +1,11 @@ Date: Thu, 18 Feb 2021 13:33:01 +0000 Subject: [PATCH 3/4] fixed typo kind of thing --- modules/opencase_cases/opencase_cases.info.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/opencase_cases/opencase_cases.info.yml b/modules/opencase_cases/opencase_cases.info.yml index ec9d37f..945069d 100644 --- a/modules/opencase_cases/opencase_cases.info.yml +++ b/modules/opencase_cases/opencase_cases.info.yml @@ -4,4 +4,4 @@ description: 'Provides case entities and a required field on activities linking core: 8.x package: 'OpenCase' dependencies: - - opencase_cases + - opencase_entities From 1d257538fe5213dbeda4aa6520a6669b87514e42 Mon Sep 17 00:00:00 2001 From: dh_6sdxgm Date: Tue, 9 Mar 2021 10:27:02 -0800 Subject: [PATCH 4/4] Changed how destination is set in contextual menu --- .../src/Plugin/Block/ContextualMenu.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/opencase_no_cases/src/Plugin/Block/ContextualMenu.php b/modules/opencase_no_cases/src/Plugin/Block/ContextualMenu.php index 0c847e3..150a8c4 100644 --- a/modules/opencase_no_cases/src/Plugin/Block/ContextualMenu.php +++ b/modules/opencase_no_cases/src/Plugin/Block/ContextualMenu.php @@ -23,8 +23,8 @@ class ContextualMenu extends BlockBase { */ 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'] = [ @@ -42,20 +42,20 @@ class ContextualMenu extends BlockBase { */ private function actorPage() { $actor_id = \Drupal::routeMatch()->getParameter('oc_actor')->id(); - $current_path = \Drupal::service('path.current')->getPath(); - return $this->generateLinksForAddingNewActivities("Add activity", ['actor_id' => $actor_id, 'destination' => $current_path]); + return $this->generateLinksForAddingNewActivities("Add activity", $actor_id); } /** * returns html markup. */ - private function generateLinksForAddingNewActivities($title, $query = []) { + private function generateLinksForAddingNewActivities($title, $actor_id) { $title = t($title); $markup = "

$title: "; $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', $query); + $url->setOption('query', ['actor_id' => $actor_id, 'destination' => $redirect_destination]); $link = \Drupal\Core\Link::fromTextAndUrl($label, $url)->toString(); $markup .= "   $link"; }