You are here

public function AssignmentAlterForm::buildForm in Features 8.4

Same name and namespace in other branches
  1. 8.3 modules/features_ui/src/Form/AssignmentAlterForm.php \Drupal\features_ui\Form\AssignmentAlterForm::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/AssignmentAlterForm.php, line 24

Class

AssignmentAlterForm
Configures the selected configuration assignment method for this site.

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);
  $core_setting = $settings['core'];
  $uuid_setting = $settings['uuid'];
  $user_permissions_setting = $settings['user_permissions'];
  $form['core'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Strip out <em>_core</em> property.'),
    '#default_value' => $core_setting,
    '#description' => $this
      ->t('Select this option to remove the <em>_core</em> configuration property on export. This property is added by Drupal core when configuration is installed.'),
  ];
  $form['uuid'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Strip out <em>uuid</em> property.'),
    '#default_value' => $uuid_setting,
    '#description' => $this
      ->t('Select this option to remove the <em>uuid</em> configuration property on export. This property is added by Drupal core when configuration is installed.'),
  ];
  $form['user_permissions'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Strip out user permissions.'),
    '#default_value' => $user_permissions_setting,
    '#description' => $this
      ->t('Select this option to remove permissions from user roles on export.'),
  ];
  $this
    ->setActions($form, self::METHOD_ID);
  return $form;
}