Commit dfd89084 authored by catch's avatar catch
Browse files

Revert "Issue #3511972 by phenaproxima, azizos, quietone, rkoller, pameeela,...

Revert "Issue #3511972 by phenaproxima, azizos, quietone, rkoller, pameeela, catch, poker10, tedbow, alexpott, larowlan, gábor hojtsy, mcdruid, xjm, benjifisher, yesct: Allow Composer and rsync location to be configured via the UI"

This reverts commit 780342ad.
parent 71cecb29
Loading
Loading
Loading
Loading
Loading
+4 −14
Original line number Diff line number Diff line
@@ -11,21 +11,11 @@ package_manager.settings:
  label: 'Package Manager settings'
  mapping:
    executables:
      type: mapping
      type: sequence
      label: 'Absolute paths to required executables, or NULL to rely on PATH'
      mapping:
        composer:
          type: string
          label: 'Absolute path to Composer executable, or NULL to auto-detect'
          nullable: true
          constraints:
            IsExecutable: []
        rsync:
      sequence:
        type: string
          label: 'Absolute path to rsync executable, or NULL to auto-detect'
          nullable: true
          constraints:
            IsExecutable: []
        label: 'Absolute path to executable, or NULL'
    additional_trusted_composer_plugins:
      type: sequence
      label: 'Additional trusted composer plugins'
+0 −1
Original line number Diff line number Diff line
@@ -7,4 +7,3 @@ lifecycle: experimental
dependencies:
  - drupal:update
hidden: true
configure: package_manager.settings
+0 −5
Original line number Diff line number Diff line
package_manager.settings:
  title: 'Package Manager settings'
  description: "Configure Package Manager and the locations of its required executables."
  parent: system.admin_config_system
  route_name: package_manager.settings
+0 −7
Original line number Diff line number Diff line
package_manager.settings:
  path: '/admin/config/system/package-manager'
  defaults:
    _title: 'Package Manager settings'
    _form: '\Drupal\package_manager\Form\SettingsForm'
  requirements:
    _permission: 'administer software updates'
+0 −69
Original line number Diff line number Diff line
<?php

declare(strict_types=1);

namespace Drupal\package_manager\Form;

use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\ConfigTarget;
use Drupal\Core\Form\FormStateInterface;

/**
 * Configures Package Manager settings.
 */
final class SettingsForm extends ConfigFormBase {

  /**
   * {@inheritdoc}
   */
  public function getFormId(): string {
    return 'package_manager_settings_form';
  }

  /**
   * {@inheritdoc}
   */
  protected function getEditableConfigNames(): array {
    return ['package_manager.settings'];
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state): array {
    $form['executables'] = [
      '#type' => 'details',
      '#title' => $this->t('Executable paths'),
      '#open' => TRUE,
      '#description' => $this->t('Configure the paths to required executables.'),
    ];
    $trim = fn (string $value): string => trim($value);

    $form['executables']['composer'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Composer executable path'),
      '#config_target' => new ConfigTarget(
        'package_manager.settings',
        'executables.composer',
        toConfig: $trim,
      ),
      '#description' => $this->t('The full path to the <code>composer</code> executable (e.g., <code>/usr/local/bin/composer</code>).'),
      '#required' => TRUE,
    ];

    $form['executables']['rsync'] = [
      '#type' => 'textfield',
      '#title' => $this->t('rsync executable path'),
      '#config_target' => new ConfigTarget(
        'package_manager.settings',
        'executables.rsync',
        toConfig: $trim,
      ),
      '#description' => $this->t('The full path to the <code>rsync</code> executable (e.g., <code>/usr/bin/rsync</code>).'),
      '#required' => TRUE,
    ];

    return parent::buildForm($form, $form_state);
  }

}
Loading