You are here

class HeartbeatTypeService in Heartbeat 8

Class HeartbeatTypeService.

@package Drupal\heartbeat

Hierarchy

Expanded class hierarchy of HeartbeatTypeService

10 files declare their use of HeartbeatTypeService
HeartbeatAltServices.php in src/HeartbeatAltServices.php
HeartbeatBlock.php in src/Plugin/Block/HeartbeatBlock.php
HeartbeatBlockDeriver.php in src/Plugin/Derivative/HeartbeatBlockDeriver.php
HeartbeatEventSubscriber.php in src/EventSubscriber/HeartbeatEventSubscriber.php
HeartbeatFeedBlock.php in src/Plugin/Block/HeartbeatFeedBlock.php

... See full list

1 string reference to 'HeartbeatTypeService'
heartbeat.services.yml in ./heartbeat.services.yml
heartbeat.services.yml
1 service uses HeartbeatTypeService
heartbeat.heartbeattype in ./heartbeat.services.yml
Drupal\heartbeat\HeartbeatTypeService

File

src/HeartbeatTypeService.php, line 15

Namespace

Drupal\heartbeat
View source
class HeartbeatTypeService {

  /**
   * Drupal\Core\Entity\EntityTypeManager definition.
   *
   * @var EntityTypeManager
   */
  protected $entityTypeManager;

  /**
    +   * Drupal\Core\Entity\EntityTypeBundleInfo definition.
    +   *
    +   * @var EntityTypeBundleInfo
    +   */
  protected $entityTypeBundleInfo;

  /**
   * Drupal\Core\Entity\Query\QueryFactory definition.
   *
   * @var \Drupal\Core\Entity\Query\QueryFactory
   */
  protected $entityQuery;

  /**
   * Constructor.
   * @param EntityTypeManager $entityTypeManager
   * @param EntityTypeBundleInfo $entityTypeBundleInfo
   * @param QueryFactory $entity_query
   */
  public function __construct(EntityTypeManager $entityTypeManager, EntityTypeBundleInfo $entityTypeBundleInfo, QueryFactory $entity_query) {
    $this->entityTypeManager = $entityTypeManager;
    $this->entityTypeBundleInfo = $entityTypeBundleInfo;
    $this->entityQuery = $entity_query;
  }
  public function getTypes() {
    return $this->entityQuery
      ->get('heartbeat_type')
      ->sort('weight', 'ASC')
      ->execute();
  }
  public function load($id) {
    return $this->entityTypeManager
      ->getStorage('heartbeat_type')
      ->load($id);
  }
  public function getEntityBundles(ContentEntityType $entity) {
    return $this->entityTypeBundleInfo
      ->getBundleInfo($entity
      ->id());
  }

}

Members