You are here

class TermsMergedEvent in Term Merge 8

Event used to notify subscribers that terms were merged.

Hierarchy

  • class \Drupal\term_merge\TermsMergedEvent extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of TermsMergedEvent

1 file declares its use of TermsMergedEvent
TermsMergedEventSubscriber.php in tests/term_merge_test_events/src/EventSubscriber/TermsMergedEventSubscriber.php

File

src/TermsMergedEvent.php, line 11

Namespace

Drupal\term_merge
View source
class TermsMergedEvent extends Event {

  /**
   * Array of terms. These terms are getting merged into $targetTerm.
   *
   * @var \Drupal\taxonomy\Entity\Term[]
   */
  protected $sourceTerms;

  /**
   * Target Term. All $sourceTerms are getting merged into this.
   *
   * @var \Drupal\taxonomy\Entity\Term
   */
  protected $targetTerm;

  /**
   * Constructor.
   *
   * @param array $sourceTerms
   *   Terms to merge.
   * @param \Drupal\taxonomy\Entity\Term $targetTerm
   *   Target Term.
   */
  public function __construct(array $sourceTerms, Term $targetTerm) {
    $this->sourceTerms = $sourceTerms;
    $this->targetTerm = $targetTerm;
  }

  /**
   * Retrieve the terms that are being merged into the target term.
   *
   * @return array
   *   An array of terms to merge.
   */
  public function getSourceTerms() {
    return $this->sourceTerms;
  }

  /**
   * Get the single target term.
   *
   * @return \Drupal\taxonomy\Entity\Term
   *   Single target term object.
   */
  public function getTargetTerm() {
    return $this->targetTerm;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TermsMergedEvent::$sourceTerms protected property Array of terms. These terms are getting merged into $targetTerm.
TermsMergedEvent::$targetTerm protected property Target Term. All $sourceTerms are getting merged into this.
TermsMergedEvent::getSourceTerms public function Retrieve the terms that are being merged into the target term.
TermsMergedEvent::getTargetTerm public function Get the single target term.
TermsMergedEvent::__construct public function Constructor.