You are here

class AvailableCountriesEvent in Address 8

Defines the available countries event.

Hierarchy

Expanded class hierarchy of AvailableCountriesEvent

See also

\Drupal\address\Event\AddressEvents

\Drupal\address\Plugin\Field\FieldType\AddressItem::getAvailableCountries

2 files declare their use of AvailableCountriesEvent
AddressTestEventSubscriber.php in tests/modules/address_test/src/EventSubscriber/AddressTestEventSubscriber.php
AvailableCountriesTrait.php in src/Plugin/Field/FieldType/AvailableCountriesTrait.php

File

src/Event/AvailableCountriesEvent.php, line 14

Namespace

Drupal\address\Event
View source
class AvailableCountriesEvent extends Event {

  /**
   * The available countries.
   *
   * A list of country codes.
   *
   * @var array
   */
  protected $availableCountries;

  /**
   * The field definition.
   *
   * @var \Drupal\Core\Field\FieldDefinitionInterface
   */
  protected $fieldDefinition;

  /**
   * Constructs a new AvailableCountriesEvent object.
   *
   * @param array $available_countries
   *   The available countries.
   * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
   *   The field definition.
   */
  public function __construct(array $available_countries, FieldDefinitionInterface $field_definition) {
    $this->availableCountries = $available_countries;
    $this->fieldDefinition = $field_definition;
  }

  /**
   * Gets the available countries.
   *
   * @return array
   *   The available countries.
   */
  public function getAvailableCountries() {
    return $this->availableCountries;
  }

  /**
   * Sets the available countries.
   *
   * @param array $available_countries
   *   The available countries to set.
   *
   * @return $this
   */
  public function setAvailableCountries(array $available_countries) {
    $this->availableCountries = $available_countries;
    return $this;
  }

  /**
   * Gets the field definition.
   *
   * @return \Drupal\Core\Field\FieldDefinitionInterface
   *   The field definition.
   */
  public function getFieldDefinition() {
    return $this->fieldDefinition;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AvailableCountriesEvent::$availableCountries protected property The available countries.
AvailableCountriesEvent::$fieldDefinition protected property The field definition.
AvailableCountriesEvent::getAvailableCountries public function Gets the available countries.
AvailableCountriesEvent::getFieldDefinition public function Gets the field definition.
AvailableCountriesEvent::setAvailableCountries public function Sets the available countries.
AvailableCountriesEvent::__construct public function Constructs a new AvailableCountriesEvent object.