You are here

class HeartbeatBlockDeriver in Heartbeat 8

Provides a block plugin definitions for Heartbeat

Hierarchy

Expanded class hierarchy of HeartbeatBlockDeriver

File

src/Plugin/Derivative/HeartbeatBlockDeriver.php, line 17

Namespace

Drupal\heartbeat\Plugin\Derivative
View source
class HeartbeatBlockDeriver extends DeriverBase implements ContainerDeriverInterface {

  /**
   * Drupal\heartbeat\HeartbeatTypeService definition.
   *
   * @var \Drupal\heartbeat\HeartbeatTypeService
   */
  protected $heartbeatTypeService;

  /**
   * Drupal\heartbeat\HeartbeatStreamServices definition.
   *
   * @var \Drupal\heartbeat\HeartbeatStreamServices
   */
  protected $heartbeatStreamService;

  /**
   * Drupal\heartbeat\HeartbeatService definition.
   *
   * @var \Drupal\heartbeat\HeartbeatService
   */
  protected $heartbeatService;

  /**
   * Construct.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param string $plugin_definition
   *   The plugin implementation definition.
   */
  public function __construct($plugin_id, HeartbeatTypeService $heartbeat_heartbeattype, HeartbeatStreamServices $heartbeatstream, HeartbeatService $heartbeat) {
    parent::__construct($plugin_id);
    $this->heartbeatTypeService = $heartbeat_heartbeattype;
    $this->heartbeatStreamServices = $heartbeatstream;
    $this->heartbeatService = $heartbeat;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, $plugin_id) {
    return new static($plugin_id, $container
      ->get('heartbeat.heartbeattype'), $container
      ->get('heartbeatstream'), $container
      ->get('heartbeat'));
  }

  /**
   * {@inheritdoc}
   */
  public function build() {
    $build = [];
    $build['heartbeat_block']['#markup'] = 'Implement HeartbeatBlock.';
    return $build;
  }
  public function getDerivativeDefinitions($base_plugin_definition) {
    $def2 = parent::getDerivativeDefinitions($base_plugin_definition);
    return $base_plugin_definition;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
HeartbeatBlockDeriver::$heartbeatService protected property Drupal\heartbeat\HeartbeatService definition.
HeartbeatBlockDeriver::$heartbeatStreamService protected property Drupal\heartbeat\HeartbeatStreamServices definition.
HeartbeatBlockDeriver::$heartbeatTypeService protected property Drupal\heartbeat\HeartbeatTypeService definition.
HeartbeatBlockDeriver::build public function
HeartbeatBlockDeriver::create public static function Creates a new class instance. Overrides ContainerDeriverInterface::create
HeartbeatBlockDeriver::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions
HeartbeatBlockDeriver::__construct public function Construct.