At the heart of every CMS stands the content, an abstraction that the publishers can manipulate and that will later be presented to the page's users. The content's structure greatly depends on the project's needs, and it will have a significant impact on future development and use of the platform.
The ContentBundle provides a basic implementation of a content document classes, including support for multiple languages and association to Routes.
StaticContent class declares the basic content's structure. Its structure
is very similar to the ones used on Symfony2's ORM systems. Most of its
fields are self explanatory and are what you would expect from a basic CMS:
title, body, publishing information and a parent reference, to accommodate a
tree-like hierarchy. It also includes a Block reference (more on that later).
This document class implements three interfaces that enable additional functionality:
RouteReferrersInterfacemeans that the content has associated Routes.
PublishTimePeriodInterfacemeans that the content has publishing and
unpublishing dates, which will be handled by Symfony CMF's core to determine whether or not to display the content from
PublishableInterfacemeans that the content has a boolean flag,
which will be handled by Symfony CMF's core to determine whether or not to display the content from
A controller is also included that can render either of the above content
document types. Its single action,
indexAction, accepts a content
instance and optionally the path of the template to be used for rendering.
If no template path is provided, it uses a pre-configured default.
The controller action also takes into account the document's publishing status
and language (for
MultilangStaticContent). Both the content instance and the
optional template are provided to the controller by the
the RoutingBundle. More information on this is available on the
Routing system getting started page
The last component needed to handle the included content types is an administration panel. Symfony CMF can optionally support SonataDoctrinePHPCRAdminBundle, a back office generation tool.
In ContentBundle, the required administration panels are already declared in
Admin folder and configured in
will automatically be loaded if you install the SonataDoctrinePHPCRAdminBundle
(refer to The Backend - Sonata Admin for
instructions on that).
The ContentBundle also supports a set of optional configuration parameters. Refer to ContentBundle for the full configuration reference.
While this small bundle includes some vital components to a fully working CMS, it often will not provide all you need. The main idea behind it is to provide developers with a small and easy to understand starting point you can extend or use as inspiration to develop your own content types, Controllers and Admin panels.
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.