function yamlform_form_alter in YAML Form 8
Implements hook_form_alter().
File
- ./
yamlform.module, line 130 - Enables the creation of forms and questionnaires.
Code
function yamlform_form_alter(&$form, FormStateInterface $form_state, $form_id) {
if (strpos($form_id, 'yamlform_') === FALSE || strpos($form_id, 'node_') === 0) {
return;
}
$is_submission_form = $form_state
->getFormObject() instanceof YamlFormSubmissionForm;
// Don't include details toggle all for submission forms.
if (!$is_submission_form) {
$form['#attributes']['class'][] = 'js-yamlform-details-toggle';
$form['#attributes']['class'][] = 'yamlform-details-toggle';
$form['#attached']['library'][] = 'yamlform/yamlform.element.details.toggle';
}
if ($is_submission_form) {
$form['#after_build'][] = '_yamlform_form_after_build';
}
}