MergeStrategyBase.php in Conflict 8.2
File
src/ConflictResolution/MergeStrategyBase.php
View source
<?php
namespace Drupal\conflict\ConflictResolution;
use Drupal\conflict\Event\EntityConflictEvents;
use Drupal\conflict\Event\EntityConflictResolutionEvent;
use Drupal\Core\Entity\ContentEntityInterface;
abstract class MergeStrategyBase implements MergeStrategyInterface {
public function resolveConflicts(EntityConflictResolutionEvent $event) {
if ($this
->isEnabled($event)) {
$local_entity = $event
->getLocalEntity();
if ($local_entity instanceof ContentEntityInterface) {
$this
->resolveConflictsContentEntity($event);
}
}
}
public function isEnabled(EntityConflictResolutionEvent $event) : bool {
$disabled_merge_strategies = $event
->getContextParameter('merge_strategy.disabled', []);
return !in_array($this
->getMergeStrategyId(), $disabled_merge_strategies, TRUE);
}
public static function getSubscribedEvents() {
$events[EntityConflictEvents::ENTITY_CONFLICT_RESOLVE][] = [
'resolveConflicts',
];
return $events;
}
}