Problem/Motivation

WebformHandler and WebformVariant plugins use configuration settings. Settings stored in a plugin's configuration require developers to call ::getConfiguration() and then get/set the plugins configuration settings.

The current approach to setting a plugins configuration settings.

$handler = $webform->getHandler('options_limit_default');
$configuration = $handler->getConfiguration();
$configuration['settings']['limit_source_entity'] = FALSE;
$handler->setConfiguration($configuration);
$webform->save();

Proposed resolution

Add WebformPlugingSettingsTrait w/ Interface

The new approach to setting a plugins configuration settings.

$webform->getHandler('options_limit_default')
  ->setSetting('limit_source_entity', FALSE);
$webform->save();

Remaining tasks

  • Write patch
  • Run tests
  • Commit patch

User interface changes

N/A

API changes

New trait and plugin methods.

  • \Drupal\webform\Plugin\WebformPlugingSettingsTrait
  • \Drupal\webform\Plugin\WebformPlugingSettingsInterface
  • :getSettings()
  • :setSettings(array $settings)
  • :getSetting($name)
  • :setSetting($name, $value)

Data model changes

N/A

Comments

jrockowitz created an issue. See original summary.

  • b0f8362 committed on 3211832-plugin-settings
    Issue #3211832: Add WebformPlugingSettingsTrait w/ Interface
    
jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new16.31 KB
jrockowitz’s picture

Version: 6.x-dev » 8.x-5.x-dev
jrockowitz’s picture

StatusFileSize
new16.31 KB

  • jrockowitz authored a24dd15 on 3211832-plugin-settings
    Issue #3211832 by jrockowitz: Add WebformPlugingSettingsTrait w/...
jrockowitz’s picture

StatusFileSize
new18.86 KB
paulocs’s picture

StatusFileSize
new22.17 KB
new3.35 KB

I replaced some other places.
Attaching patch and interdiff. Patch must be applied in 8.x-5.x.

jrockowitz’s picture

Status: Needs review » Reviewed & tested by the community

  • paulocs authored 9320d92 on 8.x-5.x
    Issue #3211832 by jrockowitz, paulocs: Add WebformPlugingSettingsTrait w...

  • paulocs authored 9320d92 on 6.x
    Issue #3211832 by jrockowitz, paulocs: Add WebformPlugingSettingsTrait w...
jrockowitz’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.