-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Entrada List and EntradaController
- Loading branch information
Showing
3 changed files
with
143 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<?php | ||
|
||
|
||
namespace App\Form\Step\Entrada; | ||
|
||
|
||
use App\Entity\Entrada; | ||
use App\Entity\Section; | ||
use App\Entity\User; | ||
use App\Repository\SectionRepository; | ||
use App\Repository\UserRepository; | ||
use FOS\CKEditorBundle\Form\Type\CKEditorType; | ||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\TextareaType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
|
||
class StepThreeType extends AbstractType | ||
{ | ||
|
||
public function buildForm(FormBuilderInterface $builder, array $options) | ||
{ | ||
$builder | ||
->add( | ||
'titulo', | ||
CKEditorType::class, [ | ||
'required' => true, | ||
'config' => [ | ||
'uiColor' => '#ffffff', | ||
// 'toolbar' => 'full', | ||
'language' => 'es', | ||
'input_sync' => true | ||
], | ||
'attr' => [ | ||
'required' => false, | ||
'class' => 'form-control', | ||
], | ||
]) | ||
->add('contenido', CKEditorType::class, [ | ||
'required' => false, | ||
'config' => [ | ||
'uiColor' => '#ffffff', | ||
// 'toolbar' => 'full', | ||
'language' => 'es', | ||
], | ||
'attr' => [ | ||
'required' => false, | ||
'rows' => 10, | ||
// 'class' => 'form-control', | ||
], | ||
]) | ||
->add( | ||
'section', | ||
EntityType::class, | ||
[ | ||
'class' => Section::class, | ||
'mapped' => false, | ||
'label' => 'Sección?', | ||
'choice_label' => 'identificador', | ||
'placeholder' => 'Seleccione la sección donde se insertará la entrada', | ||
'required' => false, | ||
'help' => 'En qué sección estará esta entrada?', | ||
'attr' => [ | ||
'class' => 'select2-enable form-control', | ||
], | ||
] | ||
) | ||
->add( | ||
'autor', | ||
EntityType::class, | ||
[ | ||
'class' => User::class, | ||
'query_builder' => function (UserRepository $ur) { | ||
return $ur->findByRoleAutor(); | ||
}, | ||
'label' => 'Autor?', | ||
'choice_label' => 'primerNombre', | ||
'placeholder' => 'Seleccione autor', | ||
'required' => false, | ||
'help' => 'Autor de la entrada entrada?', | ||
'attr' => [ | ||
'class' => 'select2-enable', | ||
], | ||
] | ||
) | ||
; // Fin del builder | ||
} | ||
|
||
public function configureOptions(OptionsResolver $resolver) | ||
{ | ||
$resolver->setDefaults( | ||
[ | ||
'data_class' => Entrada::class, | ||
] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% extends 'base_admin_board.html.twig' %} | ||
|
||
{% block title %} | ||
|
||
{% endblock %} | ||
|
||
{% block content %} | ||
<div class="col-sm-9 mx-auto"> | ||
<a class="btn btn-info" href="{{ path('admin_entrada_index') }}">Cancelar e ir al Listado</a> | ||
</div> | ||
{% endblock %} | ||
|