Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions cms/contents/article/admin/_read_general.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
{% trans_default_domain 'sfs_cms_contents' %}

{% block title %}
{% if entity.publishedVersion %}
{% if not content_config.admin.unpublish.is_granted or is_granted(content_config.admin.unpublish.is_granted, entity) %}
<a class="btn btn-sm btn-outline-secondary float-end" href="{{ url('sfs_cms_admin_content_'~content_type~'_unpublish', {'content':entity.id}) }}"
{% if content_entity.publishedVersion %}
{% if not content_config.admin.unpublish.is_granted or is_granted(content_config.admin.unpublish.is_granted, content_entity) %}
<a class="btn btn-sm btn-outline-secondary float-end" href="{{ url('sfs_cms_admin_content_'~content_type~'_unpublish', {'content':content_entity.id}) }}"
data-confirm-modal="{{ ('admin_'~content_type~'.version_unpublish.confirm_message_raw')|trans|base64_encode }}"
data-confirm-modal-title="{{ ('admin_'~content_type~'.version_unpublish.confirm_message_title')|trans }}"
data-confirm-modal-confirm-button-type="danger"
Expand All @@ -21,30 +21,30 @@
{% block content %}
<dl>
<dt>{{ ('admin_'~content_type~'.read.name')|trans }}</dt>
<dd>{{ entity.name }}</dd>
<dd>{{ content_entity.name }}</dd>
<dt>{{ ('admin_'~content_type~'.read.sites')|trans }}</dt>
<dd>{{ entity.sites|map((site) => site|sfs_cms_site_name)|join(', ') }}</dd>
<dd>{{ content_entity.sites|map((site) => site|sfs_cms_site_name)|join(', ') }}</dd>
<dt>{{ ('admin_'~content_type~'.read.general.status')|trans }}</dt>
<dd>
{{ (content_type~'.status.'~entity.status)|trans }}
{% if entity.publishedVersion %}
(<a href="{{ url('sfs_cms_admin_content_'~content_type~'_version_info', {'content':entity, 'version':entity.publishedVersion}) }}">v{{ entity.publishedVersion.versionNumber }}</a>)
{{ (content_type~'.status.'~content_entity.status)|trans }}
{% if content_entity.publishedVersion %}
(<a href="{{ url('sfs_cms_admin_content_'~content_type~'_version_info', {'content':content_entity, 'version':content_entity.publishedVersion}) }}">v{{ content_entity.publishedVersion.versionNumber }}</a>)
{% endif %}
</dd>
{% if entity.publishedVersion %}
{% if content_entity.publishedVersion %}
<dt>{{ ('admin_'~content_type~'.read.general.publishDate')|trans }}</dt>
<dd>
{% if entity.lastModified %}
{{ entity.lastModified|date('H:i d-m-Y') }}
{% if content_entity.lastModified %}
{{ content_entity.lastModified|date('H:i d-m-Y') }}
{% endif %}
</dd>
{% endif %}
<dt>{{ ('admin_'~content_type~'.read.general.author')|trans }}</dt>
<dd>
<div class="rounded me-3 d-inline">
<img src="{{ entity.author.avatarUrl }}" alt="{{ entity.author.name }}" class="rounded-circle" width="20" height="20" />
<img src="{{ content_entity.author.avatarUrl }}" alt="{{ content_entity.author.name }}" class="rounded-circle" width="20" height="20" />
</div>
{{ entity.author.displayName }}
{{ content_entity.author.displayName }}
</dd>
{# <dt>{{ ('admin_'~content_type~'.read.readingTime')|trans }}</dt>#}
</dl>
Expand Down
28 changes: 14 additions & 14 deletions cms/contents/article/admin/list-page.html.twig
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{% trans_default_domain 'sfs_cms_contents' %}

{% for entity in collection %}
{% for content_entity in collection %}
<tr
{% if not content_config.admin.read.is_granted or is_granted(content_config.admin.read.is_granted, entity) %}
data-row-href="{{ url('sfs_cms_admin_content_'~content_type~'_details', {'content':entity.id}) }}"
{% if not content_config.admin.read.is_granted or is_granted(content_config.admin.read.is_granted, content_entity) %}
data-row-href="{{ url('sfs_cms_admin_content_'~content_type~'_details', {'content':content_entity.id}) }}"
{% endif %}
>
<td class="p-3">
<div class="rounded me-3">
<img src="{{ entity.author.avatarUrl }}" alt="{{ entity.author.name }}" class="rounded-circle" width="20" height="20" />
<img src="{{ content_entity.author.avatarUrl }}" alt="{{ content_entity.author.name }}" class="rounded-circle" width="20" height="20" />
</div>
</td>
<td class="p-3">{{ entity.name }}</td>
<td class="p-3">{{ entity.sitesSorted|map((site) => site|sfs_cms_site_name)|join(', ') }}</td>
<td class="p-3">{{ (content_type~'.status.'~entity.status)|trans }}</td>
<td class="p-3">{{ entity.publishedVersion ? entity.publishedVersion.createdAt|date('H:i d-m-Y') : '' }}</td>
<td class="p-3">{{ content_entity.name }}</td>
<td class="p-3">{{ content_entity.sitesSorted|map((site) => site|sfs_cms_site_name)|join(', ') }}</td>
<td class="p-3">{{ (content_type~'.status.'~content_entity.status)|trans }}</td>
<td class="p-3">{{ content_entity.publishedVersion ? content_entity.publishedVersion.createdAt|date('H:i d-m-Y') : '' }}</td>
<td class="p-3 text-end">
{% if not content_config.admin.read.is_granted or is_granted(content_config.admin.read.is_granted, entity) %}
<a href="{{ url('sfs_cms_admin_content_'~content_type~'_details', {'content':entity}) }}" class="ms-2 text-nowrap hidden-on-clickable-row">{{ ('admin_'~content_type~'.list.actions.details.link')|trans }} <span class="bi bi-info"></span></a>
{% if not content_config.admin.read.is_granted or is_granted(content_config.admin.read.is_granted, content_entity) %}
<a href="{{ url('sfs_cms_admin_content_'~content_type~'_details', {'content':content_entity}) }}" class="ms-2 text-nowrap hidden-on-clickable-row">{{ ('admin_'~content_type~'.list.actions.details.link')|trans }} <span class="bi bi-info"></span></a>
{% endif %}
{% if not content_config.admin.version_create.is_granted or is_granted(content_config.admin.version_create.is_granted, entity) %}
<a href="{{ url('sfs_cms_admin_content_'~content_type~'_content', {'content':entity}) }}" class="ms-2 text-nowrap">{{ ('admin_'~content_type~'.list.actions.content.link')|trans }} <span class="bi bi-pencil"></span></a>
{% if not content_config.admin.version_create.is_granted or is_granted(content_config.admin.version_create.is_granted, content_entity) %}
<a href="{{ url('sfs_cms_admin_content_'~content_type~'_content', {'content':content_entity}) }}" class="ms-2 text-nowrap">{{ ('admin_'~content_type~'.list.actions.content.link')|trans }} <span class="bi bi-pencil"></span></a>
{% endif %}
{% if not content_config.admin.preview.is_granted or is_granted(content_config.admin.preview.is_granted, entity) %}
<a href="{{ url('sfs_cms_admin_content_'~content_type~'_preview', {'content':entity}) }}" class="ms-2 text-nowrap">{{ ('admin_'~content_type~'.list.actions.preview.link')|trans }} <span class="bi bi-eye"></span></a>
{% if not content_config.admin.preview.is_granted or is_granted(content_config.admin.preview.is_granted, content_entity) %}
<a href="{{ url('sfs_cms_admin_content_'~content_type~'_preview', {'content':content_entity}) }}" class="ms-2 text-nowrap">{{ ('admin_'~content_type~'.list.actions.preview.link')|trans }} <span class="bi bi-eye"></span></a>
{% endif %}
</td>
</tr>
Expand Down
1 change: 1 addition & 0 deletions cms/contents/article/translations/sfs_cms_contents.es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ admin_article:
metaTitle.label: "Título (título del navegador y etiquetas meta)"
metaDescription.label: "Descripción (etiqueta meta)"
metaKeywords.label: "Palabras clave (etiqueta meta)"
canonicalContent.label: "Contenido canónico"
title.label: "Título del artículo"
description.label: "Excerpt"
reading_minutes.label: "Tiempo de lectura (minutos)"
Expand Down
6 changes: 3 additions & 3 deletions cms/layouts/article/edit.html.twig
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{% block body %}
<main role="main">
<div class="container">
{% for locale,title in entity.extraData.title %}
{% for locale,title in content_entity.extraData.title %}
<h1 data-lang="{{ locale }}">{{ title }}</h1>
{% endfor %}

{% for locale,description in entity.extraData.description %}
{% for locale,description in content_entity.extraData.description %}
<p data-lang="{{ locale }}">{{ description }}</p>
{% endfor %}

{{ sfs_cms_block_by_type('article_header_data', {'article': entity.id}) }}
{{ sfs_cms_block_by_type('article_header_data', {'article': content_entity.id}) }}

{{ form_row(form.data.main) }}
</div>
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
"symfony/translation": "^6.4 || ^7.4 || ^8.0"
},
"require-dev": {
"softspring/cms-data-plugin": "^6.0@dev",
"ergebnis/composer-normalize": "^2.50",
"friendsofphp/php-cs-fixer": "^3.94",
"guzzlehttp/guzzle": "^7.8.2",
"guzzlehttp/promises": "^2.0",
"phpstan/phpstan": "^2.1",
"rector/rector": "^2.3"
"rector/rector": "^2.3",
"softspring/cms-data-plugin": "^6.0@dev"
},
"suggest": {
"softspring/user-bundle": "If you want to use users as blog authors"
Expand Down
2 changes: 2 additions & 0 deletions src/Controller/ArticleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ public function listBlock(Request $request): Response
*/
public function latestBlock(Request $request): Response
{
trigger_deprecation('softspring/cms-blog-plugin', '6.0', 'The "article_latest_list" block is deprecated, use the "article_link_list" module instead.');

$locale = $this->setLocale($request);

$query = $this->getPublicQuery($request);
Expand Down
2 changes: 2 additions & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Softspring\CmsBlogPlugin\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
Expand Down
2 changes: 2 additions & 0 deletions src/Entity/ArticleContent.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Softspring\CmsBlogPlugin\Entity;

use DateTime;
Expand Down
2 changes: 2 additions & 0 deletions src/EventListener/OverrideDoctrineClassSuperclassListener.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Softspring\CmsBlogPlugin\EventListener;

use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
Expand Down
8 changes: 2 additions & 6 deletions src/Form/Admin/Article/ArticleCreateForm.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
<?php

declare(strict_types=1);

namespace Softspring\CmsBlogPlugin\Form\Admin\Article;

use Softspring\CmsBlogPlugin\Form\Type\ArticleTagsType;
use Softspring\CmsBlogPlugin\Model\ArticleAuthorInterface;
use Softspring\CmsBundle\Form\Admin\Content\ContentCreateForm;
use Softspring\CmsBundle\Form\Type\UserType;
use Softspring\CmsBundle\Translator\TranslatableContext;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
use Symfony\Component\Form\FormBuilderInterface;

class ArticleCreateForm extends ContentCreateForm
{
public function __construct(TranslatableContext $translatableContext)
{
parent::__construct($translatableContext);
}

public function buildForm(FormBuilderInterface $builder, array $options): void
{
parent::buildForm($builder, $options);
Expand Down
9 changes: 2 additions & 7 deletions src/Form/Admin/Article/ArticleDuplicateForm.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
<?php

declare(strict_types=1);

namespace Softspring\CmsBlogPlugin\Form\Admin\Article;

use Doctrine\ORM\EntityManagerInterface;
use Softspring\CmsBlogPlugin\Form\Type\ArticleTagsType;
use Softspring\CmsBlogPlugin\Model\ArticleAuthorInterface;
use Softspring\CmsBundle\Form\Admin\Content\ContentDuplicateForm;
use Softspring\CmsBundle\Form\Type\UserType;
use Softspring\CmsBundle\Translator\TranslatableContext;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
use Symfony\Component\Form\FormBuilderInterface;

class ArticleDuplicateForm extends ContentDuplicateForm
{
public function __construct(TranslatableContext $translatableContext, EntityManagerInterface $em)
{
parent::__construct($translatableContext, $em);
}

public function buildForm(FormBuilderInterface $builder, array $options): void
{
parent::buildForm($builder, $options);
Expand Down
2 changes: 2 additions & 0 deletions src/Form/Admin/Article/ArticleListFilterForm.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Softspring\CmsBlogPlugin\Form\Admin\Article;

use Softspring\CmsBlogPlugin\Model\AuthorInterface;
Expand Down
8 changes: 2 additions & 6 deletions src/Form/Admin/Article/ArticleUpdateForm.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
<?php

declare(strict_types=1);

namespace Softspring\CmsBlogPlugin\Form\Admin\Article;

use Softspring\CmsBlogPlugin\Form\Type\ArticleTagsType;
use Softspring\CmsBlogPlugin\Model\ArticleAuthorInterface;
use Softspring\CmsBundle\Form\Admin\Content\ContentUpdateForm;
use Softspring\CmsBundle\Form\Type\UserType;
use Softspring\CmsBundle\Translator\TranslatableContext;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
use Symfony\Component\Form\FormBuilderInterface;

class ArticleUpdateForm extends ContentUpdateForm
{
public function __construct(TranslatableContext $translatableContext)
{
parent::__construct($translatableContext);
}

public function buildForm(FormBuilderInterface $builder, array $options): void
{
parent::buildForm($builder, $options);
Expand Down
2 changes: 2 additions & 0 deletions src/Form/ArticleListFilterForm.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Softspring\CmsBlogPlugin\Form;

use Softspring\CmsBlogPlugin\Entity\ArticleContent;
Expand Down
4 changes: 3 additions & 1 deletion src/Form/Type/ArticleTagsType.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Softspring\CmsBlogPlugin\Form\Type;

use Softspring\CmsBlogPlugin\Manager\ArticleTagManager;
Expand All @@ -23,7 +25,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
$builder->addModelTransformer(new CallbackTransformer(
fn (?array $tags): string => json_encode($tags ?? [], JSON_THROW_ON_ERROR),
function (?string $tags): array {
if (empty($tags)) {
if (in_array($tags, [null, '', '0'], true)) {
return [];
}

Expand Down
4 changes: 3 additions & 1 deletion src/Form/Type/BlogArticleTagType.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Softspring\CmsBlogPlugin\Form\Type;

use Softspring\CmsBlogPlugin\Manager\ArticleTagManager;
Expand All @@ -21,7 +23,7 @@ public function getParent(): string
public function configureOptions(OptionsResolver $resolver): void
{
$tags = $this->articleTagManager->getExistingTags();
$choices = array_combine($tags, $tags) ?: [];
$choices = array_combine($tags, $tags);

$resolver->setDefaults([
'required' => false,
Expand Down
2 changes: 2 additions & 0 deletions src/Model/ArticleAuthorInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Softspring\CmsBlogPlugin\Model;

interface ArticleAuthorInterface
Expand Down
2 changes: 2 additions & 0 deletions src/Model/ArticleContentInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Softspring\CmsBlogPlugin\Model;

use DateTime;
Expand Down
2 changes: 2 additions & 0 deletions src/Model/AuthorInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Softspring\CmsBlogPlugin\Model;

interface AuthorInterface
Expand Down