_update_manager_check_backends example

$container->get('module_handler'),
      $container->get('state'),
      $container->getParameter('site.path')
    );
  }

  /** * {@inheritdoc} */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $this->moduleHandler->loadInclude('update', 'inc', 'update.manager');
    if (!_update_manager_check_backends($form, 'update')) {
      return $form;
    }

    $form['backup'] = [
      '#prefix' => '<strong>',
      '#markup' => $this->t('Back up your database and site before you continue. <a href=":backup_url">Learn how</a>.', [':backup_url' => 'https://www.drupal.org/node/22281']),
      '#suffix' => '</strong>',
    ];

    $form['maintenance_mode'] = [
      '#title' => $this->t('Perform updates with site in maintenance mode (strongly recommended)'),
      
$container->get('module_handler'),
      $container->getParameter('site.path'),
      $container->get('plugin.manager.archiver')
    );
  }

  /** * {@inheritdoc} */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $this->moduleHandler->loadInclude('update', 'inc', 'update.manager');
    if (!_update_manager_check_backends($form, 'install')) {
      return $form;
    }

    $form['help_text'] = [
      '#prefix' => '<p>',
      '#markup' => $this->t('You can find <a href=":module_url">modules</a> and <a href=":theme_url">themes</a> on <a href=":drupal_org_url">drupal.org</a>. The following file extensions are supported: %extensions.', [
        ':module_url' => 'https://www.drupal.org/project/modules',
        ':theme_url' => 'https://www.drupal.org/project/themes',
        ':drupal_org_url' => 'https://www.drupal.org',
        '%extensions' => $this->archiverManager->getExtensions(),
      ]),
      
/** * {@inheritdoc} */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $this->moduleHandler->loadInclude('update', 'inc', 'update.manager');

    $form['last_check'] = [
      '#theme' => 'update_last_check',
      '#last' => $this->state->get('update.last_check', 0),
    ];

    if (!_update_manager_check_backends($form, 'update')) {
      return $form;
    }

    $available = update_get_available(TRUE);
    if (empty($available)) {
      $form['message'] = [
        '#markup' => $this->t('There was a problem getting update information. Try again later.'),
      ];
      return $form;
    }

    
Home | Imprint | This part of the site doesn't use cookies.