Issue #3439844 by ivnish, KrakenBite, larowlan, smustgrave: Add setting to move comment form after comments
(cherry picked from commit 26e593af85
)
merge-requests/7849/head
parent
d35edb34b2
commit
2ef2b35041
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -540,6 +540,8 @@ function olivero_preprocess_field__comment(&$variables) {
|
|||
|
||||
$variables['#cache']['contexts'][] = 'user';
|
||||
}
|
||||
|
||||
$variables['comment_form_position'] = theme_get_setting('comment_form_position');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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'),
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue