protected function AssignmentConfigureForm::loadBundleValues in Features 8.4
Same name and namespace in other branches
- 8.3 modules/features_ui/src/Form/AssignmentConfigureForm.php \Drupal\features_ui\Form\AssignmentConfigureForm::loadBundleValues()
Load the values from the bundle into the user input. Used during Ajax callback since updating #default_values is ignored.
Parameters
mixed $bundle_name: The bundle name.
\Drupal\Core\Form\FormStateInterface $form_state: The form values.
1 call to AssignmentConfigureForm::loadBundleValues()
- AssignmentConfigureForm::buildForm in modules/
features_ui/ src/ Form/ AssignmentConfigureForm.php - Form constructor.
File
- modules/
features_ui/ src/ Form/ AssignmentConfigureForm.php, line 78
Class
- AssignmentConfigureForm
- Configures the configuration assignment methods for this site.
Namespace
Drupal\features_ui\FormCode
protected function loadBundleValues($bundle_name, FormStateInterface &$form_state, $current_bundle, $enabled_methods, $methods_weight) {
$input = $form_state
->getUserInput();
if ($bundle_name == self::NEW_BUNDLE_SELECT_VALUE) {
$input['bundle']['name'] = '';
$input['bundle']['machine_name'] = '';
$input['bundle']['description'] = '';
$input['bundle']['is_profile'] = NULL;
$input['bundle']['profile_name'] = '';
}
else {
$input['bundle']['name'] = $current_bundle
->getName();
$input['bundle']['machine_name'] = $current_bundle
->getMachineName();
$input['bundle']['description'] = $current_bundle
->getDescription();
$input['bundle']['is_profile'] = $current_bundle
->isProfile() ? 1 : NULL;
$input['bundle']['profile_name'] = $current_bundle
->isProfile() ? $current_bundle
->getProfileName() : '';
}
foreach ($methods_weight as $method_id => $weight) {
$enabled = isset($enabled_methods[$method_id]);
$input['weight'][$method_id] = $weight;
$input['enabled'][$method_id] = $enabled ? 1 : NULL;
}
$form_state
->setUserInput($input);
}