twin-elements / post-bundle
Posts for CMS
Installs: 137
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.1 || ^8.0
- symfony/framework-bundle: ^4.4 || ^5.4
- twin-elements/admin-bundle: ^1.11
- twin-elements/seo-bundle: ^1.0
Conflicts
- twin-elements/admin-bundle: <1.11.3
README
#Installation 1.composer
2.Add to routes.yaml
post_admin:
resource: "@TwinElementsPostBundle/Controller/Admin/"
prefix: /admin
type: annotation
requirements:
_locale: '%app_locales%'
defaults:
_locale: '%locale%'
_admin_locale: '%admin_locale%'
options: { i18n: false }
Preview url generator
Create class PostPreviewGenerator
class PostPreviewGenerator implements PostPreviewGeneratorInterface { private RouterInterface $router; public function __construct(RouterInterface $router) { $this->router = $router; } public function generatePreviewUrl(Post $post): string { return $this->router->generate('post', [ 'id' => $post->getId(), 'slug' => $post->getSlug() ]); } }
in service.yaml
services: TwinElements\PostBundle\UrlGenerator\PostPreviewGeneratorInterface: alias: 'App\PreviewUrlGenerator\PostPreviewGenerator'