Skip to content
This repository has been archived by the owner on Aug 18, 2024. It is now read-only.

Other Groups field should respect bundles config #643

Merged
merged 1 commit into from
Jul 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/Plugin/Field/FieldWidget/OgComplex.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,16 +288,21 @@ protected function otherGroupsWidget(FieldItemListInterface $items, FormStateInt
* A single entity reference input.
*/
public function otherGroupsSingle($delta, EntityInterface $entity = NULL, $weight_delta = 10) {
$selection_settings = [
'other_groups' => TRUE,
'field_mode' => 'admin',
];
if ($this->getFieldSetting('handler_settings')) {
$selection_settings += $this->getFieldSetting('handler_settings');
}

return [
'target_id' => [
// @todo Allow this to be configurable with a widget setting.
'#type' => 'entity_autocomplete',
'#target_type' => $this->fieldDefinition->getFieldStorageDefinition()->getSetting('target_type'),
'#selection_handler' => 'og:default',
'#selection_settings' => [
'other_groups' => TRUE,
'field_mode' => 'admin',
],
'#selection_settings' => $selection_settings,
'#default_value' => $entity,
],
'_weight' => [
Expand Down