WebformHandlerPluginCollection.php in Webform 8.5
File
src/Plugin/WebformHandlerPluginCollection.php
View source
<?php
namespace Drupal\webform\Plugin;
use Drupal\Core\Plugin\DefaultLazyPluginCollection;
use Drupal\webform\Plugin\WebformHandler\BrokenWebformHandler;
class WebformHandlerPluginCollection extends DefaultLazyPluginCollection {
public function sortHelper($a_id, $b_id) {
$a = $this
->get($a_id);
$b = $this
->get($b_id);
$a_weight = $a
->getWeight();
$b_weight = $b
->getWeight();
if ($a_weight === $b_weight) {
return strnatcasecmp($a
->getHandlerId(), $b
->getHandlerId());
}
return $a_weight < $b_weight ? -1 : 1;
}
protected function initializePlugin($instance_id) {
parent::initializePlugin($instance_id);
$plugin = $this
->get($instance_id);
if ($plugin instanceof BrokenWebformHandler) {
$original_id = $this->configurations[$instance_id]['id'];
$plugin
->setPluginId($original_id);
}
}
}