heartbeat8_heartbeattype = $heartbeat8_heartbeattype; $this->heartbeatstream = $heartbeatstream; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static( $container->get('heartbeat8.heartbeattype'), $container->get('heartbeatstream') ); } /** * Start. * * @return string * Return Hello string. */ public function start($arg) { $streamEntity = $this->heartbeatstream->getEntityById(1); $types = $streamEntity->get('types'); $i = 1; foreach($types->getValue() as $heartbeatType) { $arg .= ' ' . $i . '. ' . $heartbeatType['target_id']; $i++; } $emptyVariable = 'not empty'; return [ '#type' => 'markup', '#markup' => $this->t('Implement method: start with parameter(s): ' . $arg), ]; } }