Skip to content

Commit

Permalink
Add support for help_block
Browse files Browse the repository at this point in the history
  • Loading branch information
edhgoose committed Dec 4, 2019
1 parent 0e05946 commit e12ee3d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Limenius/Liform/Transformer/AbstractTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,19 @@ protected function addDescription(FormInterface $form, array $schema)
$translationDomain = $form->getConfig()->getOption('translation_domain');

$formConfig = $form->getConfig();
if ($help = $formConfig->getOption('help', '')) {
$schema['description'] = $this->translator->trans($help, [], $translationDomain);

/*
* Here at Mention Me we use the "help_block" from the MopaBootstrapBundle.
* As part of Symfony 4.1, the "help" option has been standardised. We should prepare to switch over to
* that.
*
* In the meantime, we'll look at both: the help field first, and if not set, the help_block.
*/
$helpFields = ["help", "help_block"];
foreach ($helpFields as $helpField) {
if ($help = $formConfig->getOption($helpField, '')) {
$schema['description'] = $this->translator->trans($help, [], $translationDomain);
}
}

if ($liform = $formConfig->getOption('liform')) {
Expand Down

0 comments on commit e12ee3d

Please sign in to comment.