fixed return type of client_id callback when creating a case
This commit is contained in:
parent
0de22b7e90
commit
4b84c99541
@ -11,6 +11,11 @@ use Drupal\Core\Routing\RouteMatchInterface;
|
|||||||
use Drupal\user\Entity\Role;
|
use Drupal\user\Entity\Role;
|
||||||
use Drupal\user\RoleInterface;
|
use Drupal\user\RoleInterface;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function opencase_defaults_client_callback():array {
|
||||||
|
return [\Drupal::request()->query->get('client_id')];
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Implements hook_help().
|
* Implements hook_help().
|
||||||
*/
|
*/
|
||||||
@ -55,6 +60,21 @@ function opencase_defaults_entity_base_field_info($entity_type) {
|
|||||||
'weight' => -6,
|
'weight' => -6,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
if ($entity_type->id() === 'oc_case') {
|
||||||
|
$fields['client'] = BaseFieldDefinition::create('entity_reference')
|
||||||
|
->setLabel('Client')
|
||||||
|
->setSetting('target_type', 'oc_actor')
|
||||||
|
->setSetting('handler', 'default')
|
||||||
|
->setTranslatable(TRUE)
|
||||||
|
->setCardinality(1)
|
||||||
|
->setSetting('handler_settings', [
|
||||||
|
['target_bundles' => ['client' => 'client'] ]
|
||||||
|
])
|
||||||
|
->setDisplayConfigurable('form', true)
|
||||||
|
->setDisplayConfigurable('view', true)
|
||||||
|
->setDefaultValueCallback('opencase_defaults_client_callback')
|
||||||
|
->setRequired(TRUE);
|
||||||
|
}
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user