Is the data you need to work with best managed with the page-oriented CMS standard or does it feel like everything is squeezed into the content-tree? If the answer is the latter, consider building your own bundle!
Why would you like to manage news articles in a dedicated area?
Why would someone want to manage news articles in a separated area and not simply create them with standard pages in a webspace? This is a good question and the answer can be quite complex.
The easiest answer is that a standard content management application is not the best way to manage masses of data. One reason is that loading a large amount of pages can take a long time (e.g. on a news-overview page).
To avoid this the data can be extracted into a faster storage such as in our example. Here we use a MySQL database which is a fast way to aggregate content based on a relational structure. You could of course use any other database that suits your needs as Sulu won’t give you any restrictions using e.g. MongoDB or whatever you like.
Creating a custom “News” bundle could be a little over-the-top if you have only a few news per month. But keep in mind that this is also a great way to extend limited features of the basic system functionalities. For instance, there is currently no way to auto archive pages. This feature can easily be implemented in your own bundle.
As you can see creating a custom bundle is mostly optional. If you are not sure what is best for your project try to answer yourself this question: Is the data you need to work with best managed with the page-oriented CMS standard or does it feel like everything is squeezed into the content-tree? If the answer is the latter, consider building your own bundle!
This tutorial requires a complete installation of Sulu-Standard.
Initialize the bundle
The first step is to initialize a simple Symfony bundle. You can do that on your own or simply run the following command:
We are following the Sulu conventions here using the xml configuration format.
As Sulu doesn’t use the "default" kernel the “auto” kernel and routing registration does not work properly. Therefor you should answer that questions with no and register them by your own.
Add the navigation link
“Admin” is a simple PHP class which will be published as a symfony service.
This initializes an empty navigation. Here we will add the navigation link for our “News” overview list. The link should be placed below the "Snippet" link which is placed inside the "Global Content" area. To achieve this you have to create the complete structure of the navigation you want to extend.
Now, when you reload the Sulu-Admin you will see the newly created navigation link "navigation.news".
The code for this part of the tutorial can be found here github.com/sulu-io/ExampleNewsBundle/pull/1.