UpdateRunnerForm.php in Scheduled Updates 8
File
src/Form/UpdateRunnerForm.php
View source
<?php
namespace Drupal\scheduled_updates\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\scheduled_updates\UpdateRunnerUtils;
use Symfony\Component\DependencyInjection\ContainerInterface;
class UpdateRunnerForm extends FormBase {
protected $scheduled_updates_update_runner;
public function __construct(UpdateRunnerUtils $scheduled_updates_update_runner) {
$this->scheduled_updates_update_runner = $scheduled_updates_update_runner;
}
public static function create(ContainerInterface $container) {
return new static($container
->get('scheduled_updates.update_runner'));
}
public function getFormId() {
return 'update_runner_form';
}
public function buildForm(array $form, FormStateInterface $form_state) {
$form['run'] = [
'#type' => 'submit',
'#value' => $this
->t('Run Updates'),
];
return $form;
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->scheduled_updates_update_runner
->runAllUpdates();
}
}