add posst card image
This commit is contained in:
parent
6b459d4f46
commit
d3a38a1b03
|
@ -51,3 +51,7 @@
|
|||
background-size: cover;
|
||||
}
|
||||
}
|
||||
|
||||
.choices__list--dropdown {
|
||||
z-index: 3;
|
||||
}
|
||||
|
|
|
@ -84,6 +84,9 @@ class Post implements EntityInterface
|
|||
#[ORM\OneToMany(targetEntity: PostFollow::class, mappedBy: 'post', orphanRemoval: true)]
|
||||
private $postFollows;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 255, nullable: true)]
|
||||
private $image2;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->categories = new ArrayCollection();
|
||||
|
@ -423,4 +426,16 @@ class Post implements EntityInterface
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImage2(): ?string
|
||||
{
|
||||
return $this->image2;
|
||||
}
|
||||
|
||||
public function setImage2(?string $image2): self
|
||||
{
|
||||
$this->image2 = $image2;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ use Symfony\Component\Validator\Constraints\Range;
|
|||
use Symfony\Component\Validator\Constraints\Url;
|
||||
use App\Form\Type\SimpleMdTextareaType;
|
||||
use App\Core\Form\Type\EditorJsTextareaType;
|
||||
use App\Core\Form\FileManager\FilePickerType;
|
||||
|
||||
class PostType extends AbstractType
|
||||
{
|
||||
|
@ -160,6 +161,20 @@ class PostType extends AbstractType
|
|||
]
|
||||
);
|
||||
|
||||
$builder->add(
|
||||
'image2',
|
||||
FilePickerType::class,
|
||||
[
|
||||
'label' => 'Image (carte)',
|
||||
'required' => false,
|
||||
'data_class' => null,
|
||||
'attr' => [
|
||||
],
|
||||
'constraints' => [
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$builder->add(
|
||||
'tags',
|
||||
CollectionType::class,
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
</span>
|
||||
</div>
|
||||
|
||||
{% for item in ['image', 'status', 'contentFormat', 'publishedAt'] %}
|
||||
{% for item in ['image', 'image2', 'status', 'contentFormat', 'publishedAt'] %}
|
||||
<div class="col-md-12">
|
||||
{{ form_row(form[item]) }}
|
||||
</div>
|
||||
|
|
|
@ -99,6 +99,17 @@
|
|||
-
|
||||
{% endif %}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-3 d-block">Image (carte)</span>
|
||||
|
||||
{% if entity.image2 %}
|
||||
<figure>
|
||||
<img src="{{ asset(entity.image2) }}" class="img-fluid">
|
||||
</figure>
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Statut</span>
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
{% set color = generate_color_by_string(post.title) %}
|
||||
|
||||
{%- set image -%}
|
||||
{%- if post.image -%}
|
||||
{%- if post.image2 -%}
|
||||
{{ asset(post.image2)|imagine_filter('post_preview_filter') }}
|
||||
{%- elseif post.image -%}
|
||||
{{ asset(post.image)|imagine_filter('post_preview_filter') }}
|
||||
{%- elseif post.quickImage -%}
|
||||
{{ post.quickImage }}
|
||||
|
|
Loading…
Reference in a new issue