🇧🇪Belgium @pbosmans

Account created on 12 September 2006, about 18 years ago
#

Recent comments

🇧🇪Belgium pbosmans

@gralm Thank you for the patch, is solves my problem.

But i found an other solution, which needs a review.
We enabled the option 'Use this paragraph field's main entity as the webform submission's source entity.' on the webform format in the form element at the paragraph manage display.
I deleted the overrule code in the WebformSubmissionForm.php when setting the sourceEntity property.
I was wondering why the overrule code is there ?

🇧🇪Belgium pbosmans

Any updates on this issue ? We have tesame problem

🇧🇪Belgium pbosmans

Added a patch that did the job for me.

🇧🇪Belgium pbosmans

Thank you very much for your response, it solved the issue.
Here are my changes for others who has tesame issues
My custom optionprovider :

class UcllHttpBasicAuthOptionProvider extends ClientCredentialsOptionProvider {

  /**
   * A string of scopes imploded from the Oauth2ClientPlugin.
   */
  private string $scopeOption;

  public function __construct(Oauth2ClientPluginInterface $clientPlugin) {
    $scopes = $clientPlugin->getScopes();
    if (!empty($scopes)) {
      $this->scopeOption = implode($clientPlugin->getScopeSeparator(), $scopes);
    }
  }
  public function getAccessTokenOptions($method, array $params) {
    if (empty($params['client_id']) || empty($params['client_secret'])) {
      throw new InvalidArgumentException('clientId and clientSecret are required for http basic auth');
    }

    $encodedCredentials = base64_encode(sprintf('%s:%s', $params['client_id'], $params['client_secret']));
    unset($params['client_id'], $params['client_secret']);

    if (!empty($this->scopeOption)) {
      $params['scope'] = $this->scopeOption;
    }

    $options = parent::getAccessTokenOptions($method, $params);
    $options['headers']['Authorization'] = 'Basic ' . $encodedCredentials;

    return $options;
  }
}

My oauth2client plugin :

/**
 * OAuth2 Client to authenticate with our services
 *
 * The client_id and client_secret is set through /admin/config/system/oauth2-client
 *
 * @Oauth2Client(
 *   id = "<your-client-id>",
 *   name = @Translation("<YOUR CLIENT NAME>"),
 *   grant_type = "client_credentials",
 *   token_uri = "https://<your-domain>/oauth2/token",
 *   authorization_uri = "",
 *   resource_owner_uri = "",
 *   scopes = { "<your-scopes>" },
 * )
 */
class UcllApi extends Oauth2ClientPluginBase {

  use StateTokenStorage;

  /**
   * {@inheritdoc}
   */
  public function getProvider(): GenericProvider {
    $provider = parent::getProvider();
    $provider->setOptionProvider(new UcllHttpBasicAuthOptionProvider($this));
    return $provider;
  }

  /**
   * {@inheritdoc}
   */
  public function getRedirectUri(): string {
    return "";
  }
}
🇧🇪Belgium pbosmans

I've created our own custom class as you suggested, but how can i add the scopes to the request.
My optionprovider is created in the Oauth2ClientPluginBase.php at line 211 => $collaboratorObjects[$type] = new $collaborator();
I can't use tesame method like the ClientCredentials option providor => $provider->setOptionProvider(new ClientCredentialsOptionProvider($clientPlugin));
It has a parameter and the custom optionsprovider not.

🇧🇪Belgium pbosmans

Tested OK, but when $fieldgroup->format_settings['classes'] already contains a value (without a space at the end), then the 'paragraphs-content' class will concatinated with the already existing value. So the fieldgroup will still be visible in the behaviour view.
A possible solution is to add a space at the begin of 'paragraphs-content' when $fieldgroup->format_settings['classes'] isn't empty.

Production build 0.71.5 2024