Kunstmaan / KunstmaanBundlesCMS

An advanced yet user-friendly content management system, based on the full stack Symfony framework combined with a whole host of community bundles. It provides a full featured, multi-language CMS system with an innovative page and form assembling process, versioning, workflow, translation and media managers and much more.
https://kunstmaancms.be
MIT License
402 stars 186 forks source link

How to translate regular route by using Kunstmaan? #736

Closed aistis- closed 8 years ago

aistis- commented 8 years ago

Hello, we have some routes which are described by annotation above the actions. Typically it has a name (e.g. vendor_user_list) and a defined path (e.g. /users/list). I have created MetaPage entity which simply extends Kunstmaan\NodeBundle\Entity\AbstractPage. The goad is to have all internal system pages controlled by Kunstmaan pages CRUD with all SEO metadata and paths translations. Could you provide an example how to create these MetaPages with all sub-entities that we would achieve the goal (e.g. have 'vendor_user_list' with path /vartotojai/sarasas (translate))?

aistis- commented 8 years ago

Are you guys planning to implement this feature?

mlebkowski commented 8 years ago

@aistis-, I can provide a PR soon that solves some of your problems. For now I have the most features you need, but without path translations (urls / slugs defined in the CMS have no effect).

When defining an action/route, you’d have to connect a CMS page/node using the internal name, i.e:

/**
 * @Route(path="/users/list", defaults={"_internal_name" = "users_list" })
 **/
public function indexAction() { … }

For path translation I’d need to hook up to the routing system, it will be more complicated.

Feel free to ping me if you won’t hear from me until the end of the week.

aistis- commented 8 years ago

@mlebkowski Sounds nice. I definitely will check it out :)

mlebkowski commented 8 years ago

@aistis-, I tried to translate the routes but it seems like a too big of a deal. long story short, I just created a bundle to attach pages to static routes. This way you can set dynamic titles, metatags, etc.

Take a look: https://packagist.org/packages/arsthanea/kunstmaan-system-pages-bundle

As for the route translation — maybe someone has a hint how to do it. I’d gladly spend some time to do it, but I need a clean solution. For now, @aistis- , you can try to define multiple routes in the backend:

/**
  * @Route("/users/list", defaults={"_internal_name" = "users_list" }, name="vendor_user_list")
  * @Route("/vartotojai/sarasas", defaults={"_internal_name" = "users_list" }, name="vendor_user_list_it")
 **/
aistis- commented 8 years ago

Thank you, @mlebkowski

We will try to implement that in our next project and give any PR if needed.