9. Criando Seções

Criar seções dentro de um formulário é muito simples. Basta um template e um pouco de css, como no exemplo abaixo:

$sectionTemplate = new \Cajudev\UI\Template('section', [
   'div' => [
      'attributes' => [
         'class' => 'col-12 section-container'
      ],
      'children' => [
         'span' => [
            'attributes' => [
               'class' => 'section-title'
            ],
            'text' => '::text'
         ]
      ]
   ]
]);
.section-container {
   width: 100%;
   border-radius: 2px;
   margin-bottom: 20px;
   background: linear-gradient(to bottom, #ff471a 0%, #ec3b0f 100%);
}

.section-title {
   font-size: 25px;
   color: white;
   font-weight: bold;
}
$easyForm = new \Cajudev\EasyForm([
   'class' => 'd-flex flex-wrap'
]);

$easyForm->templates->add($sectionTemplate);

$easyForm->create('section', ['::text' => 'Seção 1']);

Resultado:

Seção 1

Agora é só criar alguns inputs, cujos templates já foram mostrados nas seções anteriores desta documentação.

$easyForm->create('section', ['::text' => 'Seção 1']);

$easyForm->create('input', [
   '::col'   => '6',
   '::label' => 'Alguma Coisa',
   '::type'  => 'text',
]);

$easyForm->create('input', [
   '::col'   => '6',
   '::label' => 'Alguma Coisa',
   '::type'  => 'text',
]);

$easyForm->create('input', [
   '::col'   => '6',
   '::label' => 'Alguma Coisa',
   '::type'  => 'text',
]);

$easyForm->create('section', ['::text' => 'Seção 2']);

$easyForm->create('input', [
   '::col'   => '6',
   '::label' => 'Alguma Coisa',
   '::type'  => 'text',
]);

$easyForm->create('input', [
   '::col'   => '6',
   '::label' => 'Alguma Coisa',
   '::type'  => 'text',
]);

$easyForm->create('input', [
   '::col'   => '6',
   '::label' => 'Alguma Coisa',
   '::type'  => 'text',
]);

$easyForm->create('input', [
   '::col'   => '6',
   '::label' => 'Alguma Coisa',
   '::type'  => 'text',
]);

$easyForm->create('section', ['::text' => 'Seção 3']);

$easyForm->create('input', [
   '::col'   => '6',
   '::label' => 'Alguma Coisa',
   '::type'  => 'text',
]);

$easyForm->create('input', [
   '::col'   => '6',
   '::label' => 'Alguma Coisa',
   '::type'  => 'text',
]);

Resultado:

Seção 1
Seção 2
Seção 3