You are here

public function AssignmentProfileForm::buildForm in Features 8.3

Same name and namespace in other branches
  1. 8.4 modules/features_ui/src/Form/AssignmentProfileForm.php \Drupal\features_ui\Form\AssignmentProfileForm::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides FormInterface::buildForm

File

modules/features_ui/src/Form/AssignmentProfileForm.php, line 24

Class

AssignmentProfileForm
Configures the selected configuration assignment method for this profile.

Namespace

Drupal\features_ui\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $bundle_name = NULL) {
  $this->currentBundle = $this->assigner
    ->loadBundle($bundle_name);
  $settings = $this->currentBundle
    ->getAssignmentSettings(self::METHOD_ID);
  $this
    ->setConfigTypeSelect($form, $settings['types']['config'], $this
    ->t('profile'));
  $form['curated'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Add commonly-needed configuration'),
    '#default_value' => $settings['curated'],
    '#description' => $this
      ->t('Select this option to add a curated list of commonly-needed configuration including cron- and theme-related settings to the install profile.'),
  ];
  $standard_settings = $settings['standard'];
  $form['standard'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Crib from the Standard profile'),
    '#tree' => TRUE,
  ];
  $form['standard']['files'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Crib code'),
    '#default_value' => $standard_settings['files'],
    '#description' => $this
      ->t('Select this option to add configuration and other files to the optional install profile from the Drupal core Standard install profile. Without these additions, a generated install profile will be missing some important initial setup.'),
  ];
  $form['standard']['dependencies'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Crib dependencies'),
    '#default_value' => $standard_settings['dependencies'],
    '#description' => $this
      ->t('Select this option to add module and theme dependencies from the Standard install profile.'),
  ];
  $this
    ->setActions($form, self::METHOD_ID);
  return $form;
}