From 3eea455788cc4af59ea12adcf127e3d847dc8fe0 Mon Sep 17 00:00:00 2001 From: BharathKumar Date: Thu, 29 Apr 2021 22:15:21 +0530 Subject: [PATCH 1/4] Cloning issue with Event series and Event instances. --- openy_gated_content.module | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openy_gated_content.module b/openy_gated_content.module index 691c52d26..b1a0b3d88 100644 --- a/openy_gated_content.module +++ b/openy_gated_content.module @@ -193,6 +193,10 @@ function openy_gated_content_form_alter(&$form, FormStateInterface $form_state, 'eventinstance_live_stream_edit_form', 'eventinstance_virtual_meeting_edit_form', ]; + $events_bundle = [ + 'live_stream', + 'virtual_meeting', + ]; if (in_array($form_id, $event_instance_forms)) { // Collapse field_inheritance by default in event instance edit form. $form['field_inheritance']['#open'] = FALSE; @@ -211,6 +215,9 @@ function openy_gated_content_form_alter(&$form, FormStateInterface $form_state, $allowedForms[] = $entity_key . '_' . $bundle . '_form'; $allowedForms[] = $entity_key . '_' . $bundle . '_edit_form'; $allowedForms[] = $entity_key . '_' . $bundle . '_add_form'; + if (in_array($bundle, $events_bundle)) { + $allowedForms[] = $entity_key . '_' . $bundle . '_clone_form'; + } } } } From eb8ab330f18ae02c9b4d148e6859d638635076ad Mon Sep 17 00:00:00 2001 From: BharathKumar Date: Wed, 5 May 2021 18:51:26 +0530 Subject: [PATCH 2/4] Addressed review comments. --- openy_gated_content.module | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/openy_gated_content.module b/openy_gated_content.module index b1a0b3d88..264d802cb 100644 --- a/openy_gated_content.module +++ b/openy_gated_content.module @@ -193,10 +193,6 @@ function openy_gated_content_form_alter(&$form, FormStateInterface $form_state, 'eventinstance_live_stream_edit_form', 'eventinstance_virtual_meeting_edit_form', ]; - $events_bundle = [ - 'live_stream', - 'virtual_meeting', - ]; if (in_array($form_id, $event_instance_forms)) { // Collapse field_inheritance by default in event instance edit form. $form['field_inheritance']['#open'] = FALSE; @@ -207,6 +203,7 @@ function openy_gated_content_form_alter(&$form, FormStateInterface $form_state, } $gcConfig = \Drupal::config('openy_gated_content.settings')->getRawData(); + $events_bundle = $gcConfig['permissions_entities']['eventseries']; $allowedForms = []; if (!empty($gcConfig['permissions_entities'])) { $permissionEnabledEntities = $gcConfig['permissions_entities']; @@ -215,6 +212,7 @@ function openy_gated_content_form_alter(&$form, FormStateInterface $form_state, $allowedForms[] = $entity_key . '_' . $bundle . '_form'; $allowedForms[] = $entity_key . '_' . $bundle . '_edit_form'; $allowedForms[] = $entity_key . '_' . $bundle . '_add_form'; + // Check for eventseries bundle and add _clone_form into allowedForms array. if (in_array($bundle, $events_bundle)) { $allowedForms[] = $entity_key . '_' . $bundle . '_clone_form'; } From 41edae6c92bd7befc2d23c3c8ba94774bb314336 Mon Sep 17 00:00:00 2001 From: BharathKumar Date: Wed, 5 May 2021 19:00:56 +0530 Subject: [PATCH 3/4] Fixed CS comments. --- openy_gated_content.module | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openy_gated_content.module b/openy_gated_content.module index 264d802cb..570f7b92c 100644 --- a/openy_gated_content.module +++ b/openy_gated_content.module @@ -212,7 +212,8 @@ function openy_gated_content_form_alter(&$form, FormStateInterface $form_state, $allowedForms[] = $entity_key . '_' . $bundle . '_form'; $allowedForms[] = $entity_key . '_' . $bundle . '_edit_form'; $allowedForms[] = $entity_key . '_' . $bundle . '_add_form'; - // Check for eventseries bundle and add _clone_form into allowedForms array. + // Check for eventseries bundle. + // Add _clone_form into allowedForms array. if (in_array($bundle, $events_bundle)) { $allowedForms[] = $entity_key . '_' . $bundle . '_clone_form'; } From 7266aa1e67bbbbd9093aa77656492073f876d104 Mon Sep 17 00:00:00 2001 From: BharathKumar Date: Thu, 6 May 2021 19:03:12 +0530 Subject: [PATCH 4/4] Addressed review comments. --- openy_gated_content.module | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/openy_gated_content.module b/openy_gated_content.module index 570f7b92c..6be1e52cc 100644 --- a/openy_gated_content.module +++ b/openy_gated_content.module @@ -203,7 +203,6 @@ function openy_gated_content_form_alter(&$form, FormStateInterface $form_state, } $gcConfig = \Drupal::config('openy_gated_content.settings')->getRawData(); - $events_bundle = $gcConfig['permissions_entities']['eventseries']; $allowedForms = []; if (!empty($gcConfig['permissions_entities'])) { $permissionEnabledEntities = $gcConfig['permissions_entities']; @@ -212,11 +211,8 @@ function openy_gated_content_form_alter(&$form, FormStateInterface $form_state, $allowedForms[] = $entity_key . '_' . $bundle . '_form'; $allowedForms[] = $entity_key . '_' . $bundle . '_edit_form'; $allowedForms[] = $entity_key . '_' . $bundle . '_add_form'; - // Check for eventseries bundle. - // Add _clone_form into allowedForms array. - if (in_array($bundle, $events_bundle)) { - $allowedForms[] = $entity_key . '_' . $bundle . '_clone_form'; - } + // Adding _clone_form into allowedForms array. + $allowedForms[] = $entity_key . '_' . $bundle . '_clone_form'; } } }