public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {
$options = array(10 => 10, 15 => 15, 25 => 25);
$pane_form[selecciona_cantidad] = [
#type => fieldset,
#title => $this->t(Selecciona cantidad),
];
$pane_form[selecciona_cantidad][cantidad] = [
#type => radios,
#options => $options,
];
$pane_form[selecciona_cantidad][submit] = [
#type => submit,
#value => $this->t(Recargar),
#weight => 50,
#attributes => [class => [btn btn-primary]]
];
return $pane_form;
}
public function validatePaneForm(array &$pane_form, FormStateInterface $form_state, array &$complete_form) {
$options = [10,15];
$values = $form_state->getValue($pane_form[#parents]);
$cnt = $values[selecciona_cantidad][cantidad];
if (!in_array($cnt, $options)) {
$form_state->setError(
$pane_form[selecciona_cantidad][submit],
$this->t(La cantidad escogida no es correcta.)
);
return;
}
}