entityTypeManager = $entity_type_manager; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static( $container->get('entity_type.manager'), ); } /** * {@inheritdoc} */ public function getFormId() { return 'dgi_fixity_generate_form'; } /** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { /** @var \Drupal\dgi_fixity\FixityCheckStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage('fixity_check'); $form['info'] = [ '#type' => 'markup', '#markup' => $this->t('

Submitting this form generate fixity checks for @count files.

Generally this should only be required when the module is first installed.

', ['@count' => $storage->countMissing()] ), ]; $form['actions'] = [ '#type' => 'actions', 'submit' => [ '#type' => 'submit', '#value' => $this->t('Generate'), '#button_type' => 'primary', ], ]; return $form; } /** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $batch = FixityCheckBatchGenerate::build(); batch_set($batch); } }