|
@@ -6,6 +6,9 @@ use Drupal\Core\Controller\ControllerBase;
|
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
use Drupal\heartbeat\HeartbeatTypeServices;
|
|
use Drupal\heartbeat\HeartbeatTypeServices;
|
|
use Drupal\heartbeat\HeartbeatStreamServices;
|
|
use Drupal\heartbeat\HeartbeatStreamServices;
|
|
|
|
+use Symfony\Component\Routing\Route;
|
|
|
|
+use Symfony\Component\Routing\RouteCollection;
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* Class TestController.
|
|
* Class TestController.
|
|
@@ -26,13 +29,13 @@ class TestController extends ControllerBase {
|
|
*
|
|
*
|
|
* @var HeartbeatStreamServices
|
|
* @var HeartbeatStreamServices
|
|
*/
|
|
*/
|
|
- protected $heartbeatstream;
|
|
|
|
|
|
+ protected $heartbeatStream;
|
|
/**
|
|
/**
|
|
* {@inheritdoc}
|
|
* {@inheritdoc}
|
|
*/
|
|
*/
|
|
public function __construct(HeartbeatTypeServices $heartbeat_heartbeattype, HeartbeatStreamServices $heartbeatstream) {
|
|
public function __construct(HeartbeatTypeServices $heartbeat_heartbeattype, HeartbeatStreamServices $heartbeatstream) {
|
|
$this->heartbeat_heartbeattype = $heartbeat_heartbeattype;
|
|
$this->heartbeat_heartbeattype = $heartbeat_heartbeattype;
|
|
- $this->heartbeatstream = $heartbeatstream;
|
|
|
|
|
|
+ $this->heartbeatStream = $heartbeatstream;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -42,6 +45,7 @@ class TestController extends ControllerBase {
|
|
return new static(
|
|
return new static(
|
|
$container->get('heartbeat.heartbeattype'),
|
|
$container->get('heartbeat.heartbeattype'),
|
|
$container->get('heartbeatstream')
|
|
$container->get('heartbeatstream')
|
|
|
|
+
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -52,36 +56,22 @@ class TestController extends ControllerBase {
|
|
* Return Hello string.
|
|
* Return Hello string.
|
|
*/
|
|
*/
|
|
public function start($arg) {
|
|
public function start($arg) {
|
|
|
|
+ foreach ($this->heartbeatStream->getAllStreams() as $heartbeatStream) {
|
|
|
|
|
|
- $node = \Drupal\node\Entity\Node::load(186);
|
|
|
|
-
|
|
|
|
- $streamEntities = $this->heartbeatstream->loadAllEntities();
|
|
|
|
-
|
|
|
|
- foreach ($streamEntities as $streamEntityId) {
|
|
|
|
-
|
|
|
|
- $streamEntity = $this->heartbeatstream->getEntityById($streamEntityId);
|
|
|
|
- $types = $streamEntity->get('types');
|
|
|
|
- $arg .= 'Stream:: ' . $streamEntity->id();
|
|
|
|
|
|
+ $route = new Route(
|
|
|
|
+ $heartbeatStream->getPath()->getValue()[0]['value'],
|
|
|
|
|
|
- $i = 1;
|
|
|
|
|
|
+ array(
|
|
|
|
+ '_controller' => '\Drupal\heartbeat\Controller\HeartbeatStreamController::createRoute',
|
|
|
|
+ '_title' => $heartbeatStream->getName(),
|
|
|
|
+ 'heartbeatStreamId' => $heartbeatStream->id(),
|
|
|
|
+ ),
|
|
|
|
+ array(
|
|
|
|
+ '_permission' => 'access content',
|
|
|
|
+ )
|
|
|
|
+ );
|
|
|
|
|
|
- foreach ($types->getValue() as $heartbeatType) {
|
|
|
|
- $arg .= ' ' . $i . '. ' . $heartbeatType['target_id'];
|
|
|
|
- $i++;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
- $heartbeatTypeService = \Drupal::service('heartbeat.heartbeattype');
|
|
|
|
-
|
|
|
|
- $entityBundleInfo = $node->bundle();
|
|
|
|
- $entityType = $node->getEntityType();
|
|
|
|
- $availableBundles = $heartbeatTypeService->getEntityBundles($node->getEntityType());
|
|
|
|
-
|
|
|
|
- foreach ($heartbeatTypeService->getTypes() as $type) {
|
|
|
|
- $heartbeatTypeEntity = \Drupal::entityTypeManager()->getStorage('heartbeat_type')->load($type);
|
|
|
|
- }
|
|
|
|
- $emptyVariable = 'not empty';
|
|
|
|
-
|
|
|
|
return [
|
|
return [
|
|
'#type' => 'markup',
|
|
'#type' => 'markup',
|
|
'#markup' => $this->t('Implement method: start with parameter(s): ' . $arg),
|
|
'#markup' => $this->t('Implement method: start with parameter(s): ' . $arg),
|