You are here

class TypesInfoEvent in Charts 8.4

Same name and namespace in other branches
  1. 5.0.x src/Event/TypesInfoEvent.php \Drupal\charts\Event\TypesInfoEvent

The TypesInfoEvent.

Hierarchy

  • class \Drupal\charts\Event\TypesInfoEvent extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of TypesInfoEvent

1 file declares its use of TypesInfoEvent
TypeManager.php in src/TypeManager.php

File

src/Event/TypesInfoEvent.php, line 10

Namespace

Drupal\charts\Event
View source
class TypesInfoEvent extends Event {

  /**
   * The chart types.
   *
   * @var array
   */
  protected $types;

  /**
   * Constructs a new TypesInfoEvent object.
   *
   * @param array $types
   *   The chart type definitions.
   */
  public function __construct(array $types) {
    $this->types = $types;
  }

  /**
   * Gets the condition definitions.
   *
   * @return array
   *   The condition definitions.
   */
  public function getTypes() : array {
    return $this->types;
  }

  /**
   * Sets the condition definitions.
   *
   * @param array $types
   *   The condition definitions.
   *
   * @return $this
   */
  public function setTypes(array $types) {
    $this->types = $types;
    return $this;
  }

  /**
   * Gets a chart type.
   *
   * @param string $type
   *   The chart type name.
   *
   * @return array
   *   The chart type info.
   */
  public function getType($type) : array {
    return $this->types[$type] ?? [];
  }

  /**
   * Sets a chart type information.
   *
   * @param string $type
   *   The chart type name.
   * @param array $info
   *   The chart type information settings.
   *
   * @return $this
   */
  public function setType($type, array $info) {
    if ($this
      ->getType($type)) {
      $this->types[$type] = $info;
    }
    return $this;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TypesInfoEvent::$types protected property The chart types.
TypesInfoEvent::getType public function Gets a chart type.
TypesInfoEvent::getTypes public function Gets the condition definitions.
TypesInfoEvent::setType public function Sets a chart type information.
TypesInfoEvent::setTypes public function Sets the condition definitions.
TypesInfoEvent::__construct public function Constructs a new TypesInfoEvent object.