At Kunstmaan we hold the "continuous improvement"-mantra in a very high regard. This means we are constantly looking for ways to improve quality, speed of development (and as such lowering costs for our clients), and optimising developer happiness. During a review of a few past projects, we noticed some areas where these three could be improved. 

The entire content management workflow is based upon pages and pageparts. A page consists of a number of default and/or custom pageparts. These pageparts allow us to offer advanced page content to end users, without sacrificing usability, abstraction of technical implementation and content from prestation separation. Unfortunately, even a medium size website exists of a couple of different page types and a dozen of custom pageparts. While these are very simple to create, just adding up the time for the menial part of the creation resulted in a sizable amount of time. And, almost as important, since it's menial work, what developer wants to spend a lot of time on it...

Introducing the Page Generator

To create a new Page type you should run this console command:

app/console kuma:generate:page --prefix=tableprefix
The command will ask you some questions, and afterwards it will do these things for you:
  • Create an entity class for the Page type
  • Create a form type class to edit the Page in the admin interface
  • Create a page template configuration file 
  • Create a twig template to show the Page to the end users
  • Update the parent pages to allow the new page to be created via the admin interface
The only thing that you need to do afterwards, is update your database, and you will be ready to create some new pages.

Introducing the PagePart Generator

To create a new PagePart you should run this console command:

app/console kuma:generate:pagepart --prefix=tableprefix
The command will ask you some questions, and afterwards it will do these things for you:
  • Create an entity class for the PagePart
  • Create a form type class to edit the PagePart in the admin interface
  • Create a twig template to show the PagePart to the end users (basic html, should be styled afterwards)
  • Update the page section configuration so that the new PagePart can be used
All you have to do then, is update your database, and you are ready to use the new pagepart without touching a line of code!

As you can see, both generators are extremely simple to use. This will cut down creating new page types and pageparts ready for frontend integration to next to nothing. If you have any further questions or issues, please don't hesitate to file an issue at Github or hit me up on Twitter!

Questions?

Feel free to contact the author