Commit fc2e7992 authored by Youri van Koppen's avatar Youri van Koppen
Browse files

Issue #3323897 by MegaChriz, jidrone: Added missing submitConfigurationForm()...

Issue #3323897 by MegaChriz, jidrone: Added missing submitConfigurationForm() calls on Tamper plugins.
parent 304f468f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ class TamperAddForm extends TamperFormBase {
      return;
    }

    parent::submitForm($form, $form_state);
    $config = $this->prepareConfig($this->sourceField, $form_state);
    $tamper_meta = $this->feedTypeTamperManager->getTamperMeta($this->feedsFeedType);
    $tamper_meta->addTamper($config);
+14 −2
Original line number Diff line number Diff line
@@ -42,6 +42,16 @@ class TamperEditForm extends TamperFormBase {
    $this->plugin = $tamper_meta->getTamper($tamper_uuid);

    $form = parent::buildForm($form, $form_state);

    $form['source'] = [
      '#type' => 'value',
      '#value' => $this->plugin->getSetting('source'),
    ];
    $form['uuid'] = [
      '#type' => 'value',
      '#value' => $tamper_uuid,
    ];

    $form[self::VAR_TAMPER_ID]['#disabled'] = TRUE;
    return $form;
  }
@@ -50,11 +60,13 @@ class TamperEditForm extends TamperFormBase {
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    parent::submitForm($form, $form_state);
    $source = $form_state->getValue('source');
    $uuid = $form_state->getValue('uuid');
    $tamper_meta = $this->feedTypeTamperManager->getTamperMeta($this->feedsFeedType);
    $uuid = $this->plugin->getSetting('uuid');
    $tampers_config = $tamper_meta->getTampers()->getConfiguration();

    $config = $this->prepareConfig($tampers_config[$uuid]['source'], $form_state);
    $config = $this->prepareConfig($source, $form_state);
    $tamper_meta->setTamperConfig($uuid, $config);
    $this->feedsFeedType->save();

+15 −6
Original line number Diff line number Diff line
@@ -159,6 +159,16 @@ abstract class TamperFormBase extends FormBase {
    }
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    if (!empty($this->plugin)) {
      $subform_state = SubformState::createForSubform($form[self::VAR_PLUGIN_CONFIGURATION], $form, $form_state);
      $this->plugin->submitConfigurationForm($form[self::VAR_PLUGIN_CONFIGURATION], $subform_state);
    }
  }

  /**
   * Get the tamper plugin options.
   *
@@ -195,14 +205,13 @@ abstract class TamperFormBase extends FormBase {
      'plugin' => $this->plugin->getPluginId(),
      'source' => $source,
      'weight' => $form_state->getValue(self::VAR_WEIGHT),
      'label' => $form_state->getValue(
        [
      'label' => $form_state->getValue([
        self::VAR_PLUGIN_CONFIGURATION,
        self::VAR_TAMPER_LABEL,
      ]),
    ];

    $plugin_config = $form_state->getValue(self::VAR_PLUGIN_CONFIGURATION);
    $plugin_config = $this->plugin->getConfiguration();
    if ($plugin_config) {
      $config += $plugin_config;
    }
+11 −0
Original line number Diff line number Diff line
tamper.feeds_tamper_test:
  mapping:
    text:
      type: string
      label: 'String value'
    enabled:
      type: boolean
      label: 'Boolean value'
    number:
      type: float
      label: 'Float value'
+6 −0
Original line number Diff line number Diff line
name: 'Feeds Tamper test'
description: Test module for Feeds Tamper.
type: module
package: Testing
dependencies:
  - feeds_tamper:feeds_tamper
Loading