Skip to content

Commit

Permalink
feat(slb-146): remove options for config forms
Browse files Browse the repository at this point in the history
  • Loading branch information
dspachos committed Apr 12, 2024
1 parent f94d84b commit 181822e
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 152 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ interval: 10000
only_on_form_change: FALSE
active_on:
content_entity_forms: TRUE
config_entity_forms: FALSE
notification:
active: TRUE
message: "Updating preview..."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ silverback_autosave.settings:
content_entity_forms:
type: boolean
label: 'Content entity forms'
config_entity_forms:
type: boolean
label: 'Config entity forms'
notification:
type: mapping
label: 'Notification'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

use Drupal\Core\Entity\ContentEntityFormInterface;
use Drupal\Core\Entity\EntityFormInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\silverback_autosave\Form\AutosaveEntityFormHandler;
Expand Down Expand Up @@ -34,7 +33,6 @@ function silverback_autosave_entity_type_alter(array &$entity_types) {
* Implements hook_form_alter().
*/
function silverback_autosave_form_alter(&$form, FormStateInterface $form_state, $form_id) {

$active_on = \Drupal::configFactory()->get('silverback_autosave.settings')->get('active_on');
$form_object = $form_state->getFormObject();

Expand All @@ -60,11 +58,6 @@ function silverback_autosave_form_alter(&$form, FormStateInterface $form_state,
}
}
}
elseif ($form_object instanceof EntityFormInterface) {
if (!$active_on['config_entity_forms']) {
return;
}
}
else {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,3 @@ services:
class: Drupal\silverback_autosave\Form\AutosaveFormErrorHandler
decorates: form_error_handler
arguments: ['@form_error_handler.silverback_autosave.inner']

silverback_autosave.config_subscriber:
class: Drupal\silverback_autosave\EventSubscriber\ConfigSubscriber
tags:
- { name: event_subscriber }
arguments: ['@silverback_autosave.entity_form_storage']

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
];
$form['only_on_form_change'] = [
'#type' => 'checkbox',
'#access' => FALSE,
'#title' => $this->t('Run only on form change.') . ' ' . $this->t('(Experimental)'),
'#description' => $this->t('If enabled an autosave submission will only occur if the form changed since the previous autosave submission.'),
'#default_value' => $config->get('only_on_form_change'),
Expand All @@ -95,11 +96,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#title' => $this->t('Content Entity Forms'),
'#default_value' => $config->get('active_on')['content_entity_forms'],
];
$form['active_on']['config_entity_forms'] = [
'#type' => 'checkbox',
'#title' => $this->t('Config Entity Forms'),
'#default_value' => $config->get('active_on')['config_entity_forms'],
];

$form['notification'] = [
'#type' => 'fieldset',
Expand Down

0 comments on commit 181822e

Please sign in to comment.