Skip to content

Commit

Permalink
Improve comment settings and edit sidebar #846
Browse files Browse the repository at this point in the history
  • Loading branch information
mstenta committed May 17, 2024
2 parents f42fb09 + 8f10e91 commit 940acd0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [Allow multiple locations to be referenced in the planting quick form #839](https://github.com/farmOS/farmOS/pull/839)
- [Update farmOS-map to v2.3.0 #841](https://github.com/farmOS/farmOS/pull/841) to [add the ability to use custom stroke colors #201](https://github.com/farmOS/farmOS-map/issues/201) (in custom map layers)
- [Improve comment settings and edit sidebar #846](https://github.com/farmOS/farmOS/pull/846)

### Removed

Expand Down
2 changes: 1 addition & 1 deletion modules/core/comment/farm_comment.module
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function farm_comment_base_field_definition(string $entity_type) {
// Build form display settings.
$field->setDisplayOptions('form', [
'type' => 'comment_default',
'weight' => 1000,
'weight' => 450,
]);

// Build view display settings.
Expand Down
10 changes: 8 additions & 2 deletions modules/core/ui/theme/src/Form/GinContentFormBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected function getFieldGroups() {
'revision' => [
'location' => 'sidebar',
'title' => $this->t('Revision information'),
'weight' => 200,
'weight' => 500,
],
] + $this->moduleHandler->invokeAll('farm_ui_theme_field_groups', [$entity_type, $bundle]);
return $field_groups;
Expand Down Expand Up @@ -163,7 +163,7 @@ public function form(array $form, FormStateInterface $form_state) {
'#group' => $tab_group,
'#optional' => TRUE,
'#weight' => $tab_info['weight'],
'#open' => $tab_id === 'default_field_group' || $tab_group === 'advanced',
'#open' => $tab_id === 'default_field_group' || $tab_id === 'meta_field_group',
];
}

Expand All @@ -176,6 +176,12 @@ public function form(array $form, FormStateInterface $form_state) {
}
}

// Comments are a special case because the CommentWidget sets the #group
// for the widget to advanced but this weight is never set.
if (isset($form['comment']['widget'][0])) {
$form['comment']['widget'][0]['#weight'] = $form['comment']['#weight'];
}

// Add authoring information for existing entities.
if (!$this->entity->isNew()) {
$form['revision_field_group']['#optional'] = FALSE;
Expand Down

0 comments on commit 940acd0

Please sign in to comment.