Skip to content

Add help messages to some form fields #816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Form/CommentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use App\Entity\Comment;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

Expand Down Expand Up @@ -40,7 +41,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
// $builder->add('content', null, ['required' => false]);

$builder
->add('content')
->add('content', TextareaType::class, [
'help' => 'Comments not complying with our Code of Conduct will be moderated.',
])
;
}

Expand Down
3 changes: 3 additions & 0 deletions src/Form/PostType.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,17 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'label' => 'label.title',
])
->add('summary', TextareaType::class, [
'help' => 'Summaries can\'t contain Markdown or HTML contents; only plain text.',
'label' => 'label.summary',
])
->add('content', null, [
'attr' => ['rows' => 20],
'help' => 'Use Markdown to format the blog post contents. HTML is allowed too.',
'label' => 'label.content',
])
->add('publishedAt', DateTimePickerType::class, [
'label' => 'label.published_at',
'help' => 'Set the date in the future to schedule the blog post publication.',
])
->add('tags', TagsInputType::class, [
'label' => 'label.tags',
Expand Down
1 change: 1 addition & 0 deletions templates/blog/_comment_form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
{{ form_errors(form.content) }}

{{ form_widget(form.content, {attr: {rows: 10}}) }}
{{ form_help(form.content) }}
</div>

<div class="form-group">
Expand Down