Skip to content
Snippets Groups Projects
Commit 0be2a211 authored by Sascha Eggenberger's avatar Sascha Eggenberger
Browse files

Add config (default disabled for 3.x)

parent 7a6140a9
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ high_contrast_mode: false
layout_density: 'default'
show_description_toggle: false
show_user_theme_settings: false
sticky_action_buttons: false
third_party_settings:
shortcut:
module_link: true
......@@ -36,6 +36,9 @@ gin.settings:
show_user_theme_settings:
type: boolean
label: 'Let user override theme'
sticky_action_buttons:
type: boolean
label: 'Sticky action buttons'
third_party_settings:
type: mapping
label: 'Third party settings'
......
......@@ -58,6 +58,7 @@ function _gin_user_form_submit(&$form, FormStateInterface $form_state) {
'high_contrast_mode' => (bool) $form_state->getValue('high_contrast_mode'),
'layout_density' => $form_state->getValue('layout_density'),
'show_description_toggle' => $form_state->getValue('show_description_toggle'),
'sticky_action_buttons' => $form_state->getValue('sticky_action_buttons'),
];
$settings->setAll($user_settings, $account);
}
......
......@@ -283,7 +283,11 @@ class GinContentFormHelper implements ContainerInjectionInterface {
* The form id.
*/
public function stickyActionButtons(array $form = NULL, FormStateInterface $form_state = NULL, $form_id = NULL) {
$sticky_action_buttons = TRUE;
/** @var \Drupal\gin\GinSettings $settings */
$settings = \Drupal::classResolver(GinSettings::class);
// Sets default to TRUE if setting is enabled.
$sticky_action_buttons = $settings->get('sticky_action_buttons') ? TRUE : FALSE;
// API check.
$form_ids = $this->moduleHandler->invokeAll('gin_ignore_sticky_form_actions');
......
......@@ -434,6 +434,14 @@ class GinSettings implements ContainerInjectionInterface {
],
];
// Sticky action toggle.
$form['sticky_action_buttons'] = [
'#type' => 'checkbox',
'#title' => $this->t('Enable sticky action buttons') . $new_label,
'#description' => $this->t('Shows from actions in the sticky header.'),
'#default_value' => $account ? $this->get('sticky_action_buttons', $account) : $this->getDefault('sticky_action_buttons'),
];
// Show secondary toolbar in Frontend.
if (!$account) {
$form['secondary_toolbar_frontend'] = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment