namespace Lc\SovBundle\Container\Newsletter; | namespace Lc\SovBundle\Container\Newsletter; | ||||
use Lc\SovBundle\Definition\Field\Newsletter\NewsletterFieldDefinition; | |||||
use Lc\SovBundle\Factory\Newsletter\NewsletterFactory; | use Lc\SovBundle\Factory\Newsletter\NewsletterFactory; | ||||
use Lc\SovBundle\Repository\Newsletter\NewsletterRepositoryQuery; | use Lc\SovBundle\Repository\Newsletter\NewsletterRepositoryQuery; | ||||
use Lc\SovBundle\Repository\Newsletter\NewsletterStore; | use Lc\SovBundle\Repository\Newsletter\NewsletterStore; | ||||
protected NewsletterFactory $factory; | protected NewsletterFactory $factory; | ||||
protected NewsletterRepositoryQuery $repositoryQuery; | protected NewsletterRepositoryQuery $repositoryQuery; | ||||
protected NewsletterStore $store; | protected NewsletterStore $store; | ||||
protected NewsletterFieldDefinition $fieldDefinition; | |||||
public function __construct( | public function __construct( | ||||
NewsletterFactory $factory, | NewsletterFactory $factory, | ||||
NewsletterRepositoryQuery $repositoryQuery, | NewsletterRepositoryQuery $repositoryQuery, | ||||
NewsletterStore $store | |||||
NewsletterStore $store, | |||||
NewsletterFieldDefinition $fieldDefinition | |||||
) { | ) { | ||||
$this->factory = $factory; | $this->factory = $factory; | ||||
$this->repositoryQuery = $repositoryQuery; | $this->repositoryQuery = $repositoryQuery; | ||||
$this->store = $store; | $this->store = $store; | ||||
$this->fieldDefinition = $fieldDefinition; | |||||
} | } | ||||
public function getFactory(): NewsletterFactory | public function getFactory(): NewsletterFactory | ||||
{ | { | ||||
return $this->store; | return $this->store; | ||||
} | } | ||||
public function getFieldDefinition(): NewsletterFieldDefinition | |||||
{ | |||||
return $this->fieldDefinition; | |||||
} | |||||
} | } |
namespace Lc\SovBundle\Container\Site; | namespace Lc\SovBundle\Container\Site; | ||||
use Lc\SovBundle\Definition\Field\Site\NewsFieldDefinition; | |||||
use Lc\SovBundle\Factory\Site\NewsFactory; | use Lc\SovBundle\Factory\Site\NewsFactory; | ||||
use Lc\SovBundle\Repository\Site\NewsRepositoryQuery; | use Lc\SovBundle\Repository\Site\NewsRepositoryQuery; | ||||
use Lc\SovBundle\Repository\Site\NewsStore; | use Lc\SovBundle\Repository\Site\NewsStore; | ||||
protected NewsFactory $factory; | protected NewsFactory $factory; | ||||
protected NewsRepositoryQuery $repositoryQuery; | protected NewsRepositoryQuery $repositoryQuery; | ||||
protected NewsStore $store; | protected NewsStore $store; | ||||
protected NewsFieldDefinition $fieldDefinition; | |||||
public function __construct( | public function __construct( | ||||
NewsFactory $factory, | NewsFactory $factory, | ||||
NewsRepositoryQuery $repositoryQuery, | NewsRepositoryQuery $repositoryQuery, | ||||
NewsStore $store | |||||
NewsStore $store, | |||||
NewsFieldDefinition $fieldDefinition | |||||
) { | ) { | ||||
$this->factory = $factory; | $this->factory = $factory; | ||||
$this->repositoryQuery = $repositoryQuery; | $this->repositoryQuery = $repositoryQuery; | ||||
$this->store = $store; | $this->store = $store; | ||||
$this->fieldDefinition = $fieldDefinition; | |||||
} | } | ||||
public function getFactory(): NewsFactory | public function getFactory(): NewsFactory | ||||
{ | { | ||||
return $this->store; | return $this->store; | ||||
} | } | ||||
public function getFieldDefinition(): NewsFieldDefinition | |||||
{ | |||||
return $this->fieldDefinition; | |||||
} | |||||
} | } |
namespace Lc\SovBundle\Container\Site; | namespace Lc\SovBundle\Container\Site; | ||||
use Lc\SovBundle\Definition\Field\Site\PageFieldDefinition; | |||||
use Lc\SovBundle\Factory\Site\PageFactory; | use Lc\SovBundle\Factory\Site\PageFactory; | ||||
use Lc\SovBundle\Repository\Site\PageRepositoryQuery; | use Lc\SovBundle\Repository\Site\PageRepositoryQuery; | ||||
use Lc\SovBundle\Repository\Site\PageStore; | use Lc\SovBundle\Repository\Site\PageStore; | ||||
protected PageFactory $factory; | protected PageFactory $factory; | ||||
protected PageRepositoryQuery $repositoryQuery; | protected PageRepositoryQuery $repositoryQuery; | ||||
protected PageStore $store; | protected PageStore $store; | ||||
protected PageFieldDefinition $fieldDefinition; | |||||
public function __construct( | public function __construct( | ||||
PageFactory $factory, | PageFactory $factory, | ||||
PageRepositoryQuery $repositoryQuery, | PageRepositoryQuery $repositoryQuery, | ||||
PageStore $store | |||||
PageStore $store, | |||||
PageFieldDefinition $fieldDefinition | |||||
) { | ) { | ||||
$this->factory = $factory; | $this->factory = $factory; | ||||
$this->repositoryQuery = $repositoryQuery; | $this->repositoryQuery = $repositoryQuery; | ||||
$this->store = $store; | $this->store = $store; | ||||
$this->fieldDefinition = $fieldDefinition; | |||||
} | } | ||||
public function getFactory(): PageFactory | public function getFactory(): PageFactory | ||||
{ | { | ||||
return $this->store; | return $this->store; | ||||
} | } | ||||
public function getFieldDefinition(): PageFieldDefinition | |||||
{ | |||||
return $this->fieldDefinition; | |||||
} | |||||
} | } |
use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; | use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | ||||
use Lc\SovBundle\Field\CollectionField; | use Lc\SovBundle\Field\CollectionField; | ||||
use Lc\SovBundle\Field\ImageManagerField; | |||||
use Lc\SovBundle\Field\StatusField; | use Lc\SovBundle\Field\StatusField; | ||||
use Lc\SovBundle\Translation\TranslatorAdmin; | use Lc\SovBundle\Translation\TranslatorAdmin; | ||||
use PhpParser\Node\Expr\Throw_; | |||||
use Symfony\Component\Form\Extension\Core\Type\TextType; | use Symfony\Component\Form\Extension\Core\Type\TextType; | ||||
abstract class AbstractFieldDefinition | abstract class AbstractFieldDefinition | ||||
return [ | return [ | ||||
'id' => IntegerField::new('id')->onlyOnIndex()->setSortable(true), | 'id' => IntegerField::new('id')->onlyOnIndex()->setSortable(true), | ||||
'metaTitle' => TextField::new('metaTitle') | 'metaTitle' => TextField::new('metaTitle') | ||||
->setLabel('Meta Title') | |||||
->setHelp('Affiché dans les résultats de recherche Google') | |||||
->hideOnIndex(), | |||||
->setLabel('Meta : title') | |||||
->setHelp('Affiché dans les résultats de recherche Google'), | |||||
'metaDescription' => TextareaField::new('metaDescription') | 'metaDescription' => TextareaField::new('metaDescription') | ||||
->setLabel('Meta description') | |||||
->setHelp('Affiché dans les résultats de recherche Google') | |||||
->hideOnIndex(), | |||||
->setLabel('Meta : description') | |||||
->setHelp('Affiché dans les résultats de recherche Google'), | |||||
'openGraphTitle' => TextField::new('openGraphTitle') | |||||
->setLabel('OpenGraph : titre'), | |||||
'openGraphDescription' => TextareaField::new('openGraphDescription') | |||||
->setLabel('OpenGraph : description'), | |||||
'openGraphImage' => ImageManagerField::new('openGraphImage') | |||||
->setLabel('OpenGraph : image'), | |||||
'oldUrls' => CollectionField::new('oldUrls') | 'oldUrls' => CollectionField::new('oldUrls') | ||||
->setFormTypeOption('entry_type', TextType::class) | ->setFormTypeOption('entry_type', TextType::class) | ||||
->setLabel('Anciennes urls du document') | ->setLabel('Anciennes urls du document') | ||||
]; | ]; | ||||
} | } | ||||
public function configurePanelOpengraph(): array | |||||
{ | |||||
return [ | |||||
'openGraphTitle', | |||||
'openGraphDescription', | |||||
'openGraphImage' | |||||
]; | |||||
} | |||||
public function configurePanelConf(): array | public function configurePanelConf(): array | ||||
{ | { | ||||
return [ | return [ | ||||
{ | { | ||||
return array_merge( | return array_merge( | ||||
$this->configureFieldsBase(), | $this->configureFieldsBase(), | ||||
$this->configureFields() | |||||
$this->configureFields(), | |||||
); | ); | ||||
} | } | ||||
<?php | |||||
namespace Lc\SovBundle\Definition\Field\Newsletter; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||||
use Lc\SovBundle\Definition\Field\AbstractFieldDefinition; | |||||
use Lc\SovBundle\Field\BooleanField; | |||||
use Lc\SovBundle\Field\CKEditorField; | |||||
class NewsletterFieldDefinition extends AbstractFieldDefinition | |||||
{ | |||||
public function configureIndex(): array | |||||
{ | |||||
return [ | |||||
'id', | |||||
'title', | |||||
'isMain', | |||||
'status' | |||||
]; | |||||
} | |||||
public function configurePanels(): array | |||||
{ | |||||
return ['main', 'seo', 'conf']; | |||||
} | |||||
public function configurePanelMain(): array | |||||
{ | |||||
return [ | |||||
'title', | |||||
'description', | |||||
'status' | |||||
]; | |||||
} | |||||
public function configureFields(): array | |||||
{ | |||||
return [ | |||||
'title' => TextField::new('title'), | |||||
'description' => CKEditorField::new('description')->hideOnIndex(), | |||||
'isMain' => BooleanField::new('isMain')->setCustomOption('toggle_label', 'Principale'), | |||||
]; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\SovBundle\Definition\Field\Site; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\DateField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||||
use Lc\SovBundle\Definition\Field\AbstractFieldDefinition; | |||||
use Lc\SovBundle\Field\BooleanField; | |||||
use Lc\SovBundle\Field\ImageManagerField; | |||||
class NewsFieldDefinition extends AbstractFieldDefinition | |||||
{ | |||||
public function configureIndex(): array | |||||
{ | |||||
return [ | |||||
'id', | |||||
'title', | |||||
'status' | |||||
]; | |||||
} | |||||
public function configurePanels(): array | |||||
{ | |||||
return ['main', 'seo', 'opengraph', 'conf']; | |||||
} | |||||
public function configurePanelMain(): array | |||||
{ | |||||
return [ | |||||
'date', | |||||
'title', | |||||
'newsletter', | |||||
'image', | |||||
'description', | |||||
'isSent', | |||||
'status' | |||||
]; | |||||
} | |||||
public function configureFields(): array | |||||
{ | |||||
return [ | |||||
'date' => DateField::new('date') | |||||
->setFormat('d/MM/y') | |||||
->setSortable(true), | |||||
'title' => TextField::new('title')->setSortable(true), | |||||
'newsletter' => AssociationField::new('newsletter')->setSortable(true), | |||||
'image' => ImageManagerField::new('image'), | |||||
'position' => NumberField::new('position'), | |||||
'description' => TextEditorField::new('description'), | |||||
'isSent' => BooleanField::new('isSent')->setSortable(true), | |||||
]; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\SovBundle\Definition\Field\Site; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||||
use Lc\SovBundle\Definition\Field\AbstractFieldDefinition; | |||||
use Lc\SovBundle\Field\CKEditorField; | |||||
class PageFieldDefinition extends AbstractFieldDefinition | |||||
{ | |||||
public function configureIndex(): array | |||||
{ | |||||
return [ | |||||
'id', | |||||
'title', | |||||
'status' | |||||
]; | |||||
} | |||||
public function configurePanelMain(): array | |||||
{ | |||||
return [ | |||||
'title', | |||||
'description', | |||||
'status' | |||||
]; | |||||
} | |||||
public function configurePanels(): array | |||||
{ | |||||
return ['main', 'seo', 'conf']; | |||||
} | |||||
public function configureFields(): array | |||||
{ | |||||
return [ | |||||
'title' => TextField::new('title')->setSortable(true), | |||||
'description' => CKEditorField::new('description')->hideOnIndex(), | |||||
]; | |||||
} | |||||
} |
*/ | */ | ||||
abstract class NewsModel extends AbstractFullEntity implements NewsInterface, OpenGraphInterface | abstract class NewsModel extends AbstractFullEntity implements NewsInterface, OpenGraphInterface | ||||
{ | { | ||||
use OpenGraphTrait; | use OpenGraphTrait; | ||||
/** | /** | ||||
* @ORM\Column(type="datetime") | * @ORM\Column(type="datetime") | ||||
* @Gedmo\Timestampable(on="create") | * @Gedmo\Timestampable(on="create") | ||||
*/ | */ | ||||
protected $isSent; | protected $isSent; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\Newsletter\NewsletterInterface") | * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\Newsletter\NewsletterInterface") | ||||
*/ | */ |
status: Statut | status: Statut | ||||
email: Email | email: Email | ||||
value: Valeur | value: Valeur | ||||
metaTitle: Meta title | |||||
metaTitle: "Meta : titre" | |||||
metaTitle_help: Affiché dans les résultats de recherche Google | metaTitle_help: Affiché dans les résultats de recherche Google | ||||
metaDescription: Meta description | |||||
metaDescription: "Meta : description" | |||||
metaDescription_help: Affiché dans les résultats de recherche Google | metaDescription_help: Affiché dans les résultats de recherche Google | ||||
openGraphTitle: "Opengraph : titre" | |||||
openGraphDescription: "Opengraph : description" | |||||
openGraphImage: "Opengraph : image" | |||||
oldUrls: Anciennes urls | oldUrls: Anciennes urls | ||||
devAlias: Alias | devAlias: Alias | ||||
gallery: Galerie | gallery: Galerie | ||||
configuration: Configuration | configuration: Configuration | ||||
gallery: Galerie | gallery: Galerie | ||||
seo: Référencement | seo: Référencement | ||||
opengraph: Opengraph | |||||
flashes: | flashes: | ||||
success: | success: | ||||
created: L'élément a bien été créé | created: L'élément a bien été créé |
</div> | </div> | ||||
{% embed '@LcSov/adminlte/embed/form_footer.html.twig' %} | {% embed '@LcSov/adminlte/embed/form_footer.html.twig' %} | ||||
{% block width %}8{% endblock %} | |||||
{% block width %}12{% endblock %} | |||||
{% block content %} | {% block content %} | ||||
{% import '@LcSov/adminlte/macro/button.html.twig' as mbutton %} | {% import '@LcSov/adminlte/macro/button.html.twig' as mbutton %} | ||||
{{ mbutton.button({form: form_id, icon: 'fa fa-check'}) }} | {{ mbutton.button({form: form_id, icon: 'fa fa-check'}) }} |
</div> | </div> | ||||
{% embed '@LcSov/adminlte/embed/form_footer.html.twig' %} | {% embed '@LcSov/adminlte/embed/form_footer.html.twig' %} | ||||
{% block width %}8{% endblock %} | |||||
{% block width %}12{% endblock %} | |||||
{% block content %} | {% block content %} | ||||
{% import '@LcSov/adminlte/macro/button.html.twig' as mbutton %} | {% import '@LcSov/adminlte/macro/button.html.twig' as mbutton %} | ||||
{{ mbutton.button({form: form_id, icon: 'fa fa-check'}) }} | {{ mbutton.button({form: form_id, icon: 'fa fa-check'}) }} |
{% block form_footer %} | {% block form_footer %} | ||||
{% embed '@LcSov/adminlte/embed/form_footer.html.twig' %} | {% embed '@LcSov/adminlte/embed/form_footer.html.twig' %} | ||||
{% block width %}8{% endblock %} | |||||
{% block width %}12{% endblock %} | |||||
{% block content %} | {% block content %} | ||||
{% for action in entity.actions %} | {% for action in entity.actions %} | ||||
{{ include(action.templatePath, { action: action }, with_context = false) }} | {{ include(action.templatePath, { action: action }, with_context = false) }} |
<div class="content-wrapper" style="min-height: 554px;"> | <div class="content-wrapper" style="min-height: 554px;"> | ||||
{% block content %} | {% block content %} | ||||
{% block content_header_wrapper %} | {% block content_header_wrapper %} | ||||
<section class="content-header"> | <section class="content-header"> | ||||
<div class="container-fluid"> | <div class="container-fluid"> | ||||
<div class="row mb-2"> | <div class="row mb-2"> | ||||
<section class="content"> | <section class="content"> | ||||
<div class="container-fluid"> | <div class="container-fluid"> | ||||
{% block main %}{% endblock %} | |||||
{% if replace_content_with_message is defined %} | |||||
<div class="alert alert-warning" role="alert"> | |||||
{{ replace_content_with_message }} | |||||
</div> | |||||
{% else %} | |||||
{% block main %}{% endblock %} | |||||
{% endif %} | |||||
</div> | </div> | ||||
</section> | </section> | ||||
{% endblock %} | {% endblock %} | ||||
</div> | </div> | ||||