public static function CircleV2::removeParameterSubmit in Build Hooks 3.x
Same name and namespace in other branches
- 8.2 modules/build_hooks_circleci/src/Plugin/FrontendEnvironment/CircleV2.php \Drupal\build_hooks_circleci\Plugin\FrontendEnvironment\CircleV2::removeParameterSubmit()
Submission handler for the "Remove parameter" button.
File
- modules/
build_hooks_circleci/ src/ Plugin/ FrontendEnvironment/ CircleV2.php, line 218
Class
- CircleV2
- Defines a circle v2 environment.
Namespace
Drupal\build_hooks_circleci\Plugin\FrontendEnvironmentCode
public static function removeParameterSubmit(array $form, FormStateInterface $form_state) {
$button = $form_state
->getTriggeringElement();
$parameters = $form_state
->getValue([
'settings',
'parameters',
], []);
$parents = $button['#parents'];
// Remove the button.
array_pop($parents);
unset($parameters[end($parents)]);
$form_state
->setValue([
'settings',
'parameters',
], array_values($parameters));
$form_state
->setRebuild();
}