uxf / cms
3.56.4
2024-12-19 14:53 UTC
Requires
- php: ^8.3
- ext-json: *
- sentry/sentry: ^3.22 || ^4.6
- symfony/asset: ^6.4 || ^7.0
- symfony/http-client: ^6.4 || ^7.0
- symfony/mailchimp-mailer: ^6.4 || ^7.0
- symfony/psr-http-message-bridge: ^6.4 || ^7.0
- symfony/security-bundle: ^6.4 || ^7.0
- symfony/twig-bundle: ^6.4 || ^7.0
- uxf/content: 3.56.3
- uxf/datagrid: 3.56.3
- uxf/form: 3.56.3
- uxf/security: 3.56.3
- uxf/storage: 3.56.3
- dev-main
- 3.56.4
- 3.56.3
- 3.56.2
- 3.56.1
- 3.56.0
- 3.55.9
- 3.55.8
- 3.55.7
- 3.55.6
- 3.55.5
- 3.55.4
- 3.55.3
- 3.55.2
- 3.55.1
- 3.55.0
- 3.54.5
- 3.54.4
- 3.54.3
- 3.54.2
- 3.54.1
- 3.54.0
- 3.53.7
- 3.53.3
- 3.53.2
- 3.53.1
- 3.53.0
- 3.52.0
- 3.51.2
- 3.51.0
- 3.50.6
- 3.50.5
- 3.50.3
- 3.50.2
- 3.50.1
- 3.50.0
- 3.49.2
- 3.49.1
- 3.49.0
- 3.48.2
- 3.48.1
- 3.48.0
- 3.47.2
- 3.47.0
- 3.46.12
- 3.46.11
- 3.46.10
- 3.46.9
- 3.46.8
- 3.46.7
- 3.46.6
- 3.46.5
- 3.46.4
- 3.46.3
- 3.46.2
- 3.46.1
- 3.46.0
- 3.45.3
- 3.45.2
- 3.45.1
- 3.45.0
- 3.44.6
- 3.44.5
- 3.44.4
- 3.44.3
- 3.44.2
- 3.44.1
- 3.44.0
- 3.43.3
- 3.43.2
- 3.43.1
- 3.43.0
- 3.42.1
- 3.42.0
- 3.41.2
- 3.41.1
- 3.41.0
- 3.40.7
- 3.40.6
- 3.40.5
- 3.40.4
- 3.40.3
- 3.40.2
- 3.40.1
- 3.40.0
- 3.39.5
- 3.39.4
- 3.39.3
- 3.39.2
- 3.39.1
- 3.38.2
- 3.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4.2
- 2.4.1
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.0
- 1.4.0
- 1.3.0
- 1.2.1
- 1.2.0
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
- v0.10.9
- v0.10.8
- v0.10.7
- v0.10.6
- v0.10.5
- v0.10.4
- v0.10.3
- v0.10.2
- v0.10.1
- v0.10.0
- v0.9.1
- v0.9.0
- v0.8.3
- v0.8.2
- v0.8.1
- v0.8.0
- v0.7.2
- v0.7.1
- v0.7.0
- v0.6.1
- v0.6.0
- v0.5.3
- v0.5.2
- v0.5.1
- v0.5.0
- v0.4.2
- v0.4.1
- v0.4.0
- v0.3.1
- v0.3
- v0.2.4
- v0.2.3
- v0.2.2
- v0.2.1
- v0.2
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1
- dev-master
- dev-surname-fix
- dev-develop
- dev-feat/user-config-datagrid
- dev-role-serialize
This package is auto-updated.
Last update: 2024-12-19 15:36:35 UTC
README
Install
$ composer require uxf/cms
Config
// config/routes/uxf.php
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
return static function (RoutingConfigurator $routes): void {
$routes->import('@UXFCmsBundle/config/routes.php');
$routes->import('@UXFSecurityBundle/config/routes.php');
$routes->import('@UXFContentBundle/config/routes.php');
$routes->import('@UXFDataGridBundle/config/routes.php');
$routes->import('@UXFFormBundle/config/routes.php');
};
// config/packages/uxf.php
use UXF\CMS\Entity\User;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('uxf_cms', [
'audit_token' => 'xxx', # optional
'mailing' => [
'email_from' => 'info@uxf.cz',
'email_name' => 'UXF info',
'invitation_url' => 'https://uxf.cz/renew-password/',
'recovery_url' => 'https://uxf.cz/renew-password/',
'cms_recovery_url' => 'https://uxf.cz/admin/cms/renew-password/',
'tag' => env('PROJECT_TAG'),
'email_previews' => '%kernel.project_dir%/src/EmailZone/Email',
],
'storage' => [
'default_upload_namespace' => 'cms',
],
'loggable' => [
'sources' => '%kernel.project_dir%/src/Entity',
],
'logger' => [
'stdout' => [
'enabled' => true, # default false
'level' => 'notice', # optional
],
'sentry' => [
'dsn' => '%env(SENTRY_DSN)%',
'environment' => '%env(SENTRY_ENV)%',
'release' => 'none', # optional
'level' => 'warning', # optional
'traces_sample_rate' => 0.5, # default 0
],
],
]);
};
Autocomplete
A) CmsMeta attribute
Add autocompleteFields
to CmsMeta
. New autocomplete is registered automatically with name by alias.
#[ORM\Entity]
#[ORM\Table(name: 'users', schema: 'uxf_cms')]
#[CmsMeta(alias: 'user', title: 'User', autocompleteFields: ['name', 'email'])]
class User
{
...
}
B) CmsForm/CmsGrid attribute (override default autocomplete)
#[CmsForm(label: 'Uživatelská role', targetField: 'title', autocomplete: 'role')]
#[CmsGrid(label: 'Uživatelská role', targetColumn: 'title', autocomplete: 'role')]
#[ORM\ManyToOne]
private Role $role;
C) AutocompleteType
final class CategoryType implements AutocompleteType
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
) {
}
/**
* @param mixed[] $options
*/
public function buildAutocomplete(AutocompleteBuilder $builder, array $options = []): void
{
// you can use 4th $labelQuery argument - eg. '{name} {surname} ({email})'
$autocomplete = DoctrineAutocomplete::create($this->entityManager, Category::class, ['name']);
// you can modify QB conditions
$autocomplete->qb->andWhere('e.id > 1');
$builder->setAutocomplete($autocomplete);
}
public static function getName(): string
{
return 'content-category';
}
}
D) AutocompleteInterface - total custom
class TestAutocomplete implements Autocomplete
{
/**
* @return AutocompleteResult[]
*/
public function search(string $term, int $limit): array
{
...
}
}
Security
use Symfony\Component\Routing\Attribute\Route;
use UXF\Core\Attribute\Security;
final readonly class TestController
{
#[Route(path: '/api/test', name: 'test', methods: 'GET')]
#[Security(UserRole::ROLE_PROFILE)] // use 'PUBLIC' for anonymous access, 'LOGGED' for logged user (role is ignored)
public function __invoke(AppRequest $appRequest): mixed
{
...
}
}
Email previews
All email previews configured in source directory uxf_cms.mailing.email_previews
are listed at /api/cms/email/list
final class SampleEmail extends PreviewableEmail
{
public function __construct(
public readonly string $url,
) {
parent::__construct('/email-templates.twig');
}
/**
* @return self[]
*/
public static function getPreviewData(): array
{
return [
new self('https://uxf.cz'),
];
}
}
send email preview command
To test email clients there is command:
bin/console uxf:email:send-preview your-email@uxf.cz app_email-zone_email_organization-application-accepted-email
email identifier is same as preview url
Loggable
configuration
// config/packages/uxf.php
use UXF\CMS\Entity\User;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('uxf_cms', [
...
'loggable' => [
'email_previews' => [
'%kernel.project_dir%/src/**/Entity'
],
]
]);
};