diff --git a/composer.json b/composer.json index 5acd863..5b79981 100644 --- a/composer.json +++ b/composer.json @@ -65,7 +65,7 @@ "symfony/browser-kit": "^5.2", "symfony/css-selector": "^5.2", "symfony/debug-bundle": "^5.2", - "symfony/maker-bundle": "^1.0", + "symfony/maker-bundle": "^1.37", "symfony/phpunit-bridge": "^5.2", "symfony/stopwatch": "^5.2", "symfony/var-dumper": "^5.2", diff --git a/src/Entity/Blog/Post.php b/src/Entity/Blog/Post.php index a5b934d..02fe2ab 100644 --- a/src/Entity/Blog/Post.php +++ b/src/Entity/Blog/Post.php @@ -108,6 +108,11 @@ class Post implements EntityInterface */ private $quickVideoHeight; + /** + * @ORM\Column(type="boolean", options={"default"=0}) + */ + private $quickShowVideo = false; + /** * @ORM\OneToMany(targetEntity=Comment::class, mappedBy="post", orphanRemoval=true) */ @@ -446,4 +451,16 @@ class Post implements EntityInterface return $this; } + + public function getQuickShowVideo(): ?bool + { + return $this->quickShowVideo; + } + + public function setQuickShowVideo(bool $quickShowVideo): self + { + $this->quickShowVideo = $quickShowVideo; + + return $this; + } } diff --git a/src/Form/Blog/PostType.php b/src/Form/Blog/PostType.php index abb9a8c..e59a34b 100644 --- a/src/Form/Blog/PostType.php +++ b/src/Form/Blog/PostType.php @@ -223,6 +223,19 @@ class PostType extends AbstractType ] ); + $builder->add( + 'quickShowVideo', + CheckboxType::class, + [ + 'label' => 'Afficher la vidéo', + 'required' => false, + 'attr' => [ + ], + 'constraints' => [ + ], + ] + ); + $builder->add( 'quickVideoWidth', NumberType::class, diff --git a/templates/blog/post_admin/_form.html.twig b/templates/blog/post_admin/_form.html.twig index 67a93dc..35058a3 100644 --- a/templates/blog/post_admin/_form.html.twig +++ b/templates/blog/post_admin/_form.html.twig @@ -76,6 +76,12 @@ {{ form_row(form[item]) }} {% endfor %} + + {% for item in ['quickShowVideo'] %} +
+ {{ form_row(form[item]) }} +
+ {% endfor %}
diff --git a/templates/page/post/_post.html.twig b/templates/page/post/_post.html.twig index 4c22fec..e42f993 100644 --- a/templates/page/post/_post.html.twig +++ b/templates/page/post/_post.html.twig @@ -16,7 +16,7 @@ {% set title = post.title %} {% set content = post.content|murph_url %} - {% if false and post.quickVideo and post.quickVideoHeight and post.quickVideoWidth %} + {% if post.quickVideo and post.quickShowVideo and post.quickVideoHeight and post.quickVideoWidth %}