public static function CircleV2::removeParameterSubmit in Build Hooks 8.2
Same name and namespace in other branches
- 3.x 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 215
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();
}