Drupal - Syntax for using getValue to get value in an array

Put the keys in an array, for example:

$this->configuration['header']['margin-top-submit'] = $form_state->getValue(['header','margin-top']);

This worked for me in drupal 8 after many hours of testing. I hope it helps.

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
    $is_live = $form_state->getValue('settings')['is_live '];
}

Tags:

Plugins

8

Blocks