PHP code example of alkin / form-summary-bundle

1. Go to this page and download the library: Download alkin/form-summary-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

alkin / form-summary-bundle example snippets


Alkin\FormSummaryBundle\FormSummaryBundle::class => ['all' => true],

// In a controller extending Symfony's AbstractController:
$form = $this->createForm(BookingType::class, $booking);

return $this->render('booking/show.html.twig', [
    'form' => $form->createView(),
]);

$builder->add('internalNote', TextareaType::class, [
    'summary' => false,
]);

use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormView;

$builder->add('reference', TextType::class, [
    'summary_value' => static fn (FormView $view): string =>
        'REF-'.strtoupper((string) $view->vars['value']),
]);
twig
{{ form_summary(form) }}
twig
{{ form_summary(form, {summary_empty: 'Not provided'}) }}
twig
{% form_theme form with [
    'bootstrap_5_layout.html.twig',
    '@FormSummary/form_summary_layout.html.twig',
    'form/summary.html.twig'
] only %}