I have tried to add the following warning to a custom Webform element in \Drupal\foo\Plugin\WebformElement\FooSelect::form()
like the code example below and I was surprised when I saw that it has not been rendered. After some debugging it turned out that the logic at the end of \Drupal\webform\Plugin\WebformElementBase::setConfigurationFormDefaultValueRecursive()
removes elements without explicit '#access' => TRUE,
.
$form['warning'] = [
'#theme' => 'status_messages',
'#message_list' => [
'warning' => [
$this->t('Fooo'),
],
],
// '#access' => TRUE,
];
Active
6.2
Code