You are here

public static function FeaturesExportForm::preRenderRemoveInvalidCheckboxes in Features 8.4

Same name and namespace in other branches
  1. 8.3 modules/features_ui/src/Form/FeaturesExportForm.php \Drupal\features_ui\Form\FeaturesExportForm::preRenderRemoveInvalidCheckboxes()

Denies access to the checkboxes for uninstalled or empty packages and the "unpackaged" pseudo-package.

Parameters

array $form: The form build array to alter.

Return value

array The form build array.

1 call to FeaturesExportForm::preRenderRemoveInvalidCheckboxes()
FeaturesExportForm::updatePreview in modules/features_ui/src/Form/FeaturesExportForm.php
Handles switching the configuration type selector.

File

modules/features_ui/src/Form/FeaturesExportForm.php, line 528

Class

FeaturesExportForm
Defines the configuration export form.

Namespace

Drupal\features_ui\Form

Code

public static function preRenderRemoveInvalidCheckboxes(array $form) {

  /** @var \Drupal\features\Package $package */
  foreach ($form['#packages'] as $package) {

    // Remove checkboxes for packages that:
    // - have no configuration assigned and are not the profile, or
    // - are the "unpackaged" pseudo-package.
    if (empty($package
      ->getConfig()) && !($package
      ->getMachineName() == $form['#profile_package']) || $package
      ->getMachineName() == 'unpackaged') {
      $form['preview'][$package
        ->getMachineName()]['#access'] = FALSE;
    }
  }
  return $form;
}