- Issue created by @nubeli
1.0 Problem/Motivation
Whenever navigating to the CiviCRM tab on a webform (admin/structure/webform/manage/WEBFORMNAME/civicrm) I see this:
Warning: Undefined array key "caseRoles" in Drupal\webform_civicrm\Fields->wf_crm_get_fields() (line 576 of modules/contrib/webform_civicrm/src/Fields.php).
Drupal\webform_civicrm\Fields->wf_crm_get_fields('fields') (Line: 47)
Drupal\webform_civicrm\Fields->get('fields') (Line: 60)
Drupal\webform_civicrm\Utils->wf_crm_get_fields() (Line: 60)
Drupal\webform_civicrm\AdminForm->initialize(Array, Object, Object) (Line: 53)
Drupal\webform_civicrm\Form\WebformCiviCRMSettingsForm->buildForm(Array, Object)Warning: foreach() argument must be of type array|object, null given in Drupal\webform_civicrm\Fields->wf_crm_get_fields() (line 576 of modules/contrib/webform_civicrm/src/Fields.php).
Drupal\webform_civicrm\Fields->wf_crm_get_fields('fields') (Line: 47)
Drupal\webform_civicrm\Fields->get('fields') (Line: 60)
Drupal\webform_civicrm\Utils->wf_crm_get_fields() (Line: 60)
Drupal\webform_civicrm\AdminForm->initialize(Array, Object, Object) (Line: 53)
Drupal\webform_civicrm\Form\WebformCiviCRMSettingsForm->buildForm(Array, Object)
2.0 Detailed steps to reproduce (embed screenshots)
This happens when a case type is disabled and has no definition. And thus it doesn't have roles defined either.
3.0 Proposed resolution
The best thing to do here maybe is to both check if a case type is enabled and also if the array key exists.
Active
6.2
Code