Account created on 13 March 2008, over 16 years ago
#

Merge Requests

Recent comments

πŸ‡ΈπŸ‡°Slovakia tomasbarej

I was able to fix the behaviour, but I'm not so confident about the resolution because I don't really get how it might actually work before.

There is an initialisation of a plugin in QuizTrait.php with a method createWebformScorePlugin:

$plugin = $this->createWebformScorePlugin($this->configuration, $score_methodology_option);

First argument of the method should be an element where settings of the plugin should be loaded from element property #webform_score_plugin_configuration

  protected function createWebformScorePlugin(array $element, $plugin_id = NULL) {
    if (!$plugin_id) {
      $plugin_id = $this->getElementProperty($element, 'webform_score_plugin');
    }

    return $this->webformScoreManager->createInstance($plugin_id, $this->getElementProperty($element, 'webform_score_plugin_configuration'));
  }

It doesn't make sense to me to pass a $this->configuration array when there are not (or should not be) an element property.

It starts working when I pass an actual element props the method expects in form or an $element array like this:

        $element = [
          '#webform_score_plugin' => $score_methodology_option,
          '#webform_score_plugin_configuration' => $current_plugin_config,
        ];
        $plugin = $this->createWebformScorePlugin($element, $score_methodology_option);

What I'm not sure are the two more occurrences of plugin initialisation $plugin = $this->createWebformScorePlugin($this->configuration, $score_methodology_option); in methods validateConfigurationForm and submitConfigurationForm and wondering if it actually might validate or submit the values. In order to save config we need patch posted in issue https://www.drupal.org/project/webform_score/issues/2913371 πŸ› The score configuration is not saved Needs review

Production build 0.69.0 2024