How to programmatically copy Webform handler config? I would like to copy the Webform handler from 1 Webform into another. I can get hold of Webform settings via:
/** @var \Drupal\webform\WebformInterface $webform */
$webform = \Drupal::entityTypeManager()-&gt;getStorage('webform')-&gt;load('example_webform_id');
$webform-&gt;getSettings();
=&gt; [
     &quot;ajax&quot; =&gt; false,
     &quot;ajax_scroll_top&quot; =&gt; &quot;&quot;,
     &quot;ajax_progress_type&quot; =&gt; &quot;&quot;,
     &quot;ajax_effect&quot; =&gt; &quot;&quot;,
     ...

However that doesn't include the handler config that I would need and a way to save its new config as well.
I also tried it via the handler object itself:
/** @var \Drupal\webform\Plugin\WebformHandlerInterface[] $handlers */
$handlers = $webform-&gt;getHandlers('example_webform_handler_id');
$handler = $handlers-&gt;getIterator()-&gt;current();
$handler-&gt;setConfiguration($new_handler_config)-&gt;save();

for which it appears that there is no save() operation in the handler class:

Error: Call to undefined method ::save()

Any way I can do this programmatically that you may know of?
Ended up using the ConfigFactory service, which I believe is fine to do:
$config = \Drupal::configFactory()-&gt;getEditable('webform.webform.' . $webform-&gt;id());
$config_key = 'handlers.' . $webform_handler_id;
$config-&gt;set($config_key, $new_handler_config)-&gt;save();