You are here

abstract class MergeStrategyBase in Conflict 8.2

Hierarchy

Expanded class hierarchy of MergeStrategyBase

1 file declares its use of MergeStrategyBase
MergeRemoteStructure.php in modules/conflict_paragraphs/src/ConflictResolution/MergeRemoteStructure.php

File

src/ConflictResolution/MergeStrategyBase.php, line 9

Namespace

Drupal\conflict\ConflictResolution
View source
abstract class MergeStrategyBase implements MergeStrategyInterface {

  /**
   * Discovers conflicts on entities.
   *
   * @param \Drupal\conflict\Event\EntityConflictResolutionEvent
   *   The entity conflict resolution event.
   */
  public function resolveConflicts(EntityConflictResolutionEvent $event) {
    if ($this
      ->isEnabled($event)) {
      $local_entity = $event
        ->getLocalEntity();
      if ($local_entity instanceof ContentEntityInterface) {
        $this
          ->resolveConflictsContentEntity($event);
      }
    }
  }

  /**
   * {@inheritdoc}
   */
  public function isEnabled(EntityConflictResolutionEvent $event) : bool {
    $disabled_merge_strategies = $event
      ->getContextParameter('merge_strategy.disabled', []);
    return !in_array($this
      ->getMergeStrategyId(), $disabled_merge_strategies, TRUE);
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[EntityConflictEvents::ENTITY_CONFLICT_RESOLVE][] = [
      'resolveConflicts',
    ];
    return $events;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MergeStrategyBase::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
MergeStrategyBase::isEnabled public function Checks whether this merge strategy is active for the conflict resolution. Overrides MergeStrategyInterface::isEnabled
MergeStrategyBase::resolveConflicts public function Discovers conflicts on entities.
MergeStrategyInterface::getMergeStrategyId public function Returns the merge strategy ID. 2
MergeStrategyInterface::resolveConflictsContentEntity public function Resolves conflicts on content entities. 2