fixed bugs in entity type relations/widgets
This commit is contained in:
parent
050bee1a9b
commit
1878d1e2fd
@ -20,6 +20,8 @@ class EntityTypeRelations {
|
|||||||
|
|
||||||
public static function getAllowedActivityTypesForCaseType($case_type) {
|
public static function getAllowedActivityTypesForCaseType($case_type) {
|
||||||
$caseTypeConfig = \Drupal::entityTypeManager()->getStorage('oc_case_type')->load($case_type);
|
$caseTypeConfig = \Drupal::entityTypeManager()->getStorage('oc_case_type')->load($case_type);
|
||||||
return $caseTypeConfig->get('allowedActivityTypes'); // format: ['application' => 'application', 'interview' => 0]
|
$allowedActivityTypes = $caseTypeConfig->get('allowedActivityTypes'); // format: ['application' => 'application', 'interview' => 0]
|
||||||
|
if (!$allowedActivityTypes) $allowedActivityTypes = array();
|
||||||
|
return $allowedActivityTypes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,8 @@ class EntityTypeRelationsWidget {
|
|||||||
public function populate(&$form) {
|
public function populate(&$form) {
|
||||||
$case_type = $form['id']['#default_value'];
|
$case_type = $form['id']['#default_value'];
|
||||||
$allowedActorTypes = EntityTypeRelations::getAllowedActorTypesForCaseType($case_type);
|
$allowedActorTypes = EntityTypeRelations::getAllowedActorTypesForCaseType($case_type);
|
||||||
|
$form['allowed_actor_types']['#default_value'] = $allowedActorTypes;
|
||||||
|
$allowedActivityTypes = EntityTypeRelations::getAllowedActivityTypesForCaseType($case_type);
|
||||||
$form['allowed_activity_types']['#default_value'] = $allowedActivityTypes;
|
$form['allowed_activity_types']['#default_value'] = $allowedActivityTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user