Loading modules/gcontent_field/src/Plugin/Field/FieldWidget/GroupSelectorWidget.php +3 −3 Original line number Diff line number Diff line Loading @@ -246,7 +246,7 @@ class GroupSelectorWidget extends WidgetBase implements ContainerFactoryPluginIn } } else { $can_delete = $host->isNew() ?? $group->hasPermission("delete any $entity_plugin_id content", $account); $can_delete = $host->isNew() ? FALSE : $group->hasPermission("delete any $entity_plugin_id content", $account); $can_edit = $group->hasPermission("update any $entity_plugin_id content", $account); } // Checking if can delete own. Loading Loading @@ -704,7 +704,7 @@ class GroupSelectorWidget extends WidgetBase implements ContainerFactoryPluginIn $field_state['groups_cardinality'] = $groups_cardinality; static::setWidgetState($this->fieldParents, $field_name, $form_state, $field_state); } $existing_gcontent = $field_state['gcontent'] ?? []; $existing_gcontent = isset($field_state['gcontent']) ? $field_state['gcontent'] : []; $allowed_groups = $this->getAllowedGroups($groups, $entity_plugin_id, $existing_gcontent, $field_state['groups_cardinality']); if (($this->realItemCount < $cardinality || $cardinality == FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) && !$form_state->isProgrammed()) { Loading Loading @@ -1151,7 +1151,7 @@ class GroupSelectorWidget extends WidgetBase implements ContainerFactoryPluginIn if ($gcontent['mode'] == 'removed') { continue; } $gcontent_entity = $gcontent['entity'] ?? FALSE; $gcontent_entity = isset($gcontent['entity']) ? $gcontent['entity'] : FALSE; if ($gcontent_entity) { $gid = $gcontent_entity->gid->getString(); $groups_ammounts[$gid] = isset($groups_ammounts[$gid]) ? $groups_ammounts[$gid] + 1 : 1; Loading src/Form/GroupSettingsForm.php +1 −1 Original line number Diff line number Diff line Loading @@ -83,7 +83,7 @@ class GroupSettingsForm extends ConfigFormBase { $form['gcontent_field'][$entity_type_id] = [ '#type' => 'textfield', '#title' => $this->t('Label for @entity_type', ['@entity_type' => $entity_type_name]), '#default_value' => $gcontent_field_config[$entity_type_id] ?? NULL, '#default_value' => isset($gcontent_field_config[$entity_type_id]) ? $gcontent_field_config[$entity_type_id] : NULL, ]; } } Loading Loading
modules/gcontent_field/src/Plugin/Field/FieldWidget/GroupSelectorWidget.php +3 −3 Original line number Diff line number Diff line Loading @@ -246,7 +246,7 @@ class GroupSelectorWidget extends WidgetBase implements ContainerFactoryPluginIn } } else { $can_delete = $host->isNew() ?? $group->hasPermission("delete any $entity_plugin_id content", $account); $can_delete = $host->isNew() ? FALSE : $group->hasPermission("delete any $entity_plugin_id content", $account); $can_edit = $group->hasPermission("update any $entity_plugin_id content", $account); } // Checking if can delete own. Loading Loading @@ -704,7 +704,7 @@ class GroupSelectorWidget extends WidgetBase implements ContainerFactoryPluginIn $field_state['groups_cardinality'] = $groups_cardinality; static::setWidgetState($this->fieldParents, $field_name, $form_state, $field_state); } $existing_gcontent = $field_state['gcontent'] ?? []; $existing_gcontent = isset($field_state['gcontent']) ? $field_state['gcontent'] : []; $allowed_groups = $this->getAllowedGroups($groups, $entity_plugin_id, $existing_gcontent, $field_state['groups_cardinality']); if (($this->realItemCount < $cardinality || $cardinality == FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) && !$form_state->isProgrammed()) { Loading Loading @@ -1151,7 +1151,7 @@ class GroupSelectorWidget extends WidgetBase implements ContainerFactoryPluginIn if ($gcontent['mode'] == 'removed') { continue; } $gcontent_entity = $gcontent['entity'] ?? FALSE; $gcontent_entity = isset($gcontent['entity']) ? $gcontent['entity'] : FALSE; if ($gcontent_entity) { $gid = $gcontent_entity->gid->getString(); $groups_ammounts[$gid] = isset($groups_ammounts[$gid]) ? $groups_ammounts[$gid] + 1 : 1; Loading
src/Form/GroupSettingsForm.php +1 −1 Original line number Diff line number Diff line Loading @@ -83,7 +83,7 @@ class GroupSettingsForm extends ConfigFormBase { $form['gcontent_field'][$entity_type_id] = [ '#type' => 'textfield', '#title' => $this->t('Label for @entity_type', ['@entity_type' => $entity_type_name]), '#default_value' => $gcontent_field_config[$entity_type_id] ?? NULL, '#default_value' => isset($gcontent_field_config[$entity_type_id]) ? $gcontent_field_config[$entity_type_id] : NULL, ]; } } Loading