πŸ‡ΊπŸ‡ΈUnited States @cainaru

Potsdam, NY, USA
Account created on 18 October 2014, over 9 years ago
  • Drupal Developer at AcquiaΒ  …
#

Recent comments

πŸ‡ΊπŸ‡ΈUnited States cainaru Potsdam, NY, USA
πŸ‡ΊπŸ‡ΈUnited States cainaru Potsdam, NY, USA

+ My Ukrainian relatives on my dad’s side are still under threat, the war is not over yet. Let’s not become desensitized please

πŸ‡ΊπŸ‡ΈUnited States cainaru Potsdam, NY, USA

A while back when testing this, I noticed that other feeds that are using HTTP Basic Auth, but not Oauth, start failing with this patch. I wonder if modifying the submitConfigurationForm like the following might help (particularly with the failing tests) ?

  public function submitConfigurationForm(array &$form, FormStateInterface $form_state, FeedInterface $feed = NULL) {
    $feed->setSource($form_state->getValue('source'));
    // Only submit these if the feed has the Oauth option present.
    if (isset($form_state->getValue('authorization_options')['feed_authorization_setting'])) {
      $feed_config = [
        'feed_authorization_setting' => $form_state->getValue('authorization_options')['feed_authorization_setting'],
        'access_token_url' => $form_state->getValue('authorization_options')['access_token_url'],
        'grant_type' => $form_state->getValue('authorization_options')['grant_type'],
        'client_id' => $form_state->getValue('authorization_options')['client_id'],
        'scope' => $form_state->getValue('authorization_options')['scope'],
        'username' => $form_state->getValue('authorization_options')['username'],
      ];
      $client_secret = $form_state->getValue('authorization_options')['client_secret'];
      $password = $form_state->getValue('authorization_options')['password'];

      // Only save the client secret and/or password if they have been changed.
      if (!empty($client_secret)) {
        $feed_config['client_secret'] = $client_secret;
      }
      if (!empty($password)) {
        $feed_config['password'] = $password;
      }
      $feed->setConfigurationFor($this->plugin, $feed_config);
    }
  }

And perhaps setting the feed_authorization_setting to FALSE in defaultFeedConfiguration()?

Production build 0.69.0 2024