You are here

public function ContentController::deleteStatusMessages in Heartbeat 8

1 string reference to 'ContentController::deleteStatusMessages'
statusmessage.routing.yml in modules/statusmessage/statusmessage.routing.yml
modules/statusmessage/statusmessage.routing.yml

File

modules/statusmessage/src/Controller/ContentController.php, line 119

Class

ContentController
Class ContentController.

Namespace

Drupal\statusmessage\Controller

Code

public function deleteStatusMessages() {
  $entities = \Drupal::service("entity.query")
    ->get("status")
    ->execute();
  foreach ($entities as $entity) {
    $status = $this
      ->entityTypeManager()
      ->getStorage("status")
      ->load($entity);
    $status
      ->delete();
  }
  return [
    '#type' => 'markup',
    '#markup' => $this
      ->t('Deleting them statusmessages'),
  ];
}