With a config form, when saving the fields in the submit, rather than
->set('FIELD NAME', $form_state->getValue('FIELD NAME')
how would a form with #tree = true be handled?
For example: $field[topic1][subtopic_a] $field[topic1][suntopic_b]
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityWith a config form, when saving the fields in the submit, rather than
->set('FIELD NAME', $form_state->getValue('FIELD NAME')
how would a form with #tree = true be handled?
For example: $field[topic1][subtopic_a] $field[topic1][suntopic_b]
You can store an array to configuration. So you can almost use the code you provided. You could do something like:
->set('FIELD NAME', $form_state->getValue(['field_name']);
Where field_name
is the key of the element that has had #tree
set to it, containing child elements.