Issue #3439844 by ivnish, KrakenBite, larowlan, smustgrave: Add setting to move comment form after comments

(cherry picked from commit 26e593af85)
merge-requests/7849/head
nod_ 2024-04-16 11:07:42 +02:00
parent d35edb34b2
commit 2ef2b35041
No known key found for this signature in database
GPG Key ID: 76624892606FA197
6 changed files with 32 additions and 1 deletions

View File

@ -13,3 +13,4 @@ third_party_settings:
mobile_menu_all_widths: 0
site_branding_bg_color: default
base_primary_color: '#1b9ae4'
comment_form_position: 0

View File

@ -38,3 +38,6 @@ olivero.settings:
base_primary_color:
type: color_hex
label: 'Base Primary Color'
comment_form_position:
type: integer
label: 'Comment form position'

View File

@ -13,3 +13,12 @@ function olivero_post_update_add_olivero_primary_color() {
->set('base_primary_color', '#1b9ae4')
->save();
}
/**
* Sets the `comment_form_position` value of Olivero's theme settings.
*/
function olivero_post_update_add_comment_form_position() {
\Drupal::configFactory()->getEditable('olivero.settings')
->set('comment_form_position', 0)
->save(TRUE);
}

View File

@ -540,6 +540,8 @@ function olivero_preprocess_field__comment(&$variables) {
$variables['#cache']['contexts'][] = 'user';
}
$variables['comment_form_position'] = theme_get_setting('comment_form_position');
}
/**

View File

@ -42,6 +42,10 @@
{{ title_suffix }}
{% endif %}
{% if comment_form_position %}
{{ comments }}
{% endif %}
{% if comment_form %}
<div class="add-comment">
{% if user_picture %}
@ -57,6 +61,8 @@
</div>
{% endif %}
{{ comments }}
{% if not comment_form_position %}
{{ comments }}
{% endif %}
</section>

View File

@ -117,4 +117,14 @@ function olivero_form_system_theme_settings_alter(&$form, FormStateInterface $fo
],
];
}
$form['olivero_settings']['olivero_utilities']['comment_form_position'] = [
'#type' => 'radios',
'#title' => t('Comment form position'),
'#options' => [
0 => t('Before comments'),
1 => t('After comments'),
],
'#default_value' => theme_get_setting('comment_form_position'),
];
}