You are here

public function EntityReferenceRevisionsCommands::interact in Entity Reference Revisions 8

@hook interact err:purge

File

src/Commands/EntityReferenceRevisionsCommands.php, line 51

Class

EntityReferenceRevisionsCommands
A Drush commandfile.

Namespace

Drupal\entity_reference_revisions\Commands

Code

public function interact($input, $output) {
  if (empty($input
    ->getArgument('types'))) {
    $choices = [];
    foreach ($this->purger
      ->getCompositeEntityTypes() as $entity_type) {
      $choices[(string) $entity_type
        ->id()] = (string) $entity_type
        ->getLabel();
    }
    $selected = $this
      ->io()
      ->choice(dt("Choose the entity type to clear"), $choices);
    $input
      ->setArgument('types', $selected);
  }
}