function _workflow_transition_form_validate_buttons in Workflow 8
Same name and namespace in other branches
- 7.2 workflow.form.inc \_workflow_transition_form_validate_buttons()
Submit callback function for the Workflow Form / DefaultWidget.
This is only used when using action buttons in the widget. It sets the new state to proper element and sets a submit function if needed, making sure the action is executed, influencing function core/includes/form.inc/form_execute_handlers(). (While constructing the Workflow form, we were not yet aware of the submit buttons of the complete form. We try to correct this here, without adding another hook_form_alter. We guess the first button is the Save button.
1 string reference to '_workflow_transition_form_validate_buttons'
- _workflow_transition_form_get_action_buttons in ./
workflow.form.inc - Returns the action buttons from the options widget.
File
- ./
workflow.form.inc, line 262 - Contains helper functions for WorkflowTransitionForm.
Code
function _workflow_transition_form_validate_buttons($form, FormStateInterface &$form_state) {
// Retrieve the data from the form.
$transition = $form_state
->getValue('workflow_transition');
if ($transition) {
// On WorkflowTransitionForm :
// D7: $form_state['input']['to_sid'] = $new_sid;
// D7: $form_state['values'][$field_name][$langcode][0]['to_sid'] = $new_sid;
$values = $form_state
->getValues();
$to_sid = $form_state
->getTriggeringElement()['#workflow']['to_sid'];
$values['to_sid'] = $to_sid;
// Update the form_state.
$form_state
->setValues($values);
}
else {
// On edit form : See $form_state->getTriggeringElement() in WorkflowDefaultWidget;
}
}