You are here

class FilterDependencyConfigEntityEvent in Dependency Calculation 8

Class FilterDependencyConfigEntityEvent

Hierarchy

Expanded class hierarchy of FilterDependencyConfigEntityEvent

1 file declares its use of FilterDependencyConfigEntityEvent
ConfigEntityDependencyCollector.php in src/EventSubscriber/DependencyCollector/ConfigEntityDependencyCollector.php

File

src/Event/FilterDependencyConfigEntityEvent.php, line 11

Namespace

Drupal\depcalc\Event
View source
class FilterDependencyConfigEntityEvent extends Event {

  /**
   * Whether or not to calculate this config entity as a dependency.
   *
   * @var bool
   */
  protected $calculate = TRUE;

  /**
   * The dependent entity wrapper.
   *
   * @var \Drupal\depcalc\DependentEntityWrapper
   */
  protected $wrapper;

  /**
   * FilterDependencyConfigEntityEvent constructor.
   *
   * @param \Drupal\depcalc\DependentEntityWrapper $wrapper
   *   The entity wrapper for calculation.
   */
  public function __construct(DependentEntityWrapper $wrapper) {
    $this->wrapper = $wrapper;
  }

  /**
   * Get the wrapper of the entity we are considering calculating.
   *
   * @return \Drupal\depcalc\DependentEntityWrapper
   *   The entity wrapper for calculation.
   */
  public function getWrapper() {
    return $this->wrapper;
  }

  /**
   * Get the entity we are considering calculating.
   *
   * @return \Drupal\Core\Entity\EntityInterface
   *   The entity for calculation.
   */
  public function getEntity() {
    return $this->wrapper
      ->getEntity();
  }

  /**
   * Set whether if this config entity should be calculated for dependencies.
   *
   * @param bool $calculate
   *   Whether or not to calculate this entity.
   */
  public function setCalculable(bool $calculate) {
    $this->calculate = $calculate;
  }

  /**
   * Whether this config entity should be dependency calculated.
   *
   * @return bool
   *   Whether or not to calculate this entity.
   */
  public function isCalculable() {
    return $this->calculate;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FilterDependencyConfigEntityEvent::$calculate protected property Whether or not to calculate this config entity as a dependency.
FilterDependencyConfigEntityEvent::$wrapper protected property The dependent entity wrapper.
FilterDependencyConfigEntityEvent::getEntity public function Get the entity we are considering calculating.
FilterDependencyConfigEntityEvent::getWrapper public function Get the wrapper of the entity we are considering calculating.
FilterDependencyConfigEntityEvent::isCalculable public function Whether this config entity should be dependency calculated.
FilterDependencyConfigEntityEvent::setCalculable public function Set whether if this config entity should be calculated for dependencies.
FilterDependencyConfigEntityEvent::__construct public function FilterDependencyConfigEntityEvent constructor.