When I set a storage value on the form state in my blockForm method of Drupal\Core\Block\BlockBase, the storage array is empty on the blockSubmit method.
Example:
<?php
public function blockForm($form, FormStateInterface $form_state)
{
$form_state->set('test', 'Testing');
$form = parent::blockForm($form, $form_state);
// [...]
return $form;
}
public function blockSubmit($form, FormStateInterface $form_state)
{
$this->setConfigurationValue('non_form_value', $form_state->get('test')); // FormState::$storage is empty
}
?>Any ideas why this is not working?
Comments
Comment #2
amsentner commentedComment #3
xanoGood find! We're working on a fix in #2537732: PluginFormInterface must have access to the complete $form_state (introduce SubFormState for embedded forms). I'm marking this a duplicate of the other issue.