Charcoal CMS
The CMS Charcoal Module (Content Management System). Provides basic objects to build a website.
Notably, Section
(or page), News
, Event
and Faq
as well as to ather user data, notably ContactInquiry
.
This module is heavily dependant on charcoal-object
(and therefore charcoal-core
) which provides the base Content
and UserData
classes the CMS objects are dependant on.
How to install
The preferred (and only supported) way of installing charcoal-cms is with composer:
★ composer require locomotivemtl/charcoal-cms
For a complete, ready-to-use project, start from the boilerplate
:
★ composer create-project locomotivemtl/charcoal-project-boilerplate:@dev --prefer-source
Dependencies
PHP 5.6+
- PHP 7 is recommended for security and performance reasons.
locomotivemtl/charcoal-attachment
locomotivemtl/charcoal-core
- Core charcoal models and storage class.
- Provides base Model, which depends on Storable and Describable.
locomotivemtl/charcoal-object
locomotivemtl/charcoal-translator
Recommended dependencies
Objects
All objects in the charcoal-cms
module implements \Charcoal\Object\Content
, which allows to store creation & modification dates. Many objects also implement the \Charcoal\Object\PublishableInterface
.
Core objects
Section object
A section, in Charcoal, is a reachable page on the website, as part of the full hierarchical site map. They can be displayed in menus or breadcrumbs and be reached with a unique URL (routable
).
Types of sections:
blocks
- Blocks sections define their content as a structured map of blocks.
content
- Content sections define their content in a single, simple HTML property.
empty
- Empty sections are linked to a template but do not require any custom content.
external
- External sections are simply a redirect to an external (or internal) URL.
All section types, except external, make use of a Template
object to be rendered. Typically, a charcoal view
make sure of linking the template
(by default, mustache
Sections are standard Charcoal
Model
, meaning they are describable with aMetadata
object (which define a map ofproperties
) and storable with aSource
object.
Base section properties:
Name | L10n | Type | Description |
---|---|---|---|
title | ✔ | string | |
subtitle | ✔ | html | |
template_ident | string | ||
template_options | structure | ||
attachments | ✔ | multi-object |
Extra blocks properties:
Name | L10n | Type | Description |
---|---|---|---|
blocks | ✔ | structure |
Extra content properties:
Name | L10n | Type | Description |
---|---|---|---|
content | ✔ | html |
Extra external properties:
Name | L10n | Type | Description |
---|---|---|---|
external_url | ✔ | url |
Note that external
sections ignore the template_ident & template_options properties as well as the metatags set of properties.
--
Because sections extends \Charcoal\Object\Content
, they also have the following standard properties:
Name | L10n | Type | Description |
---|---|---|---|
id1 | |||
active | |||
position | |||
created | |||
created_by | |||
last_modified | |||
last_modified_by |
[1] By default, the key of the section is the id..
--
Sections are hierarchical. They can be indented inside one another to create multi-dimensional site maps. The additional properties are therefore available:
Name | L10n | Type | Description |
---|---|---|---|
master |
The hierarchical interface (\Charcoal\Object\HierarchicalInterface
) also provide the following methods, amongst others:
hierarchy()
children()
siblings()
--
Sections have metatags.
Name | L10n | Type | Description |
---|---|---|---|
meta_title | ✔ | string | |
meta_description | ✔ | text | |
meta_image | ✔ | image | |
meta_author | ✔ | string |
...and more specialized properties, for facebook / opengraph.
__
Like all Content objects, sections implement the \Charcoal\Object\RevisionableInterface
, which tracks all save / update into revisions.
Extending the section object
The \Charcoal\Cms\Section\*
objects are final
. To extend, use the \Charcoal\Cms\AbstractSection
base object instead, to make sure no metadata conflicts arise.
CMS objects
Event object
FAQ object
News object
Development
To install the development environment:
$ composer install --prefer-source
API documentation
- The auto-generated
phpDocumentor
API documentation is available at https://locomotivemtl.github.io/charcoal-cms/docs/master/ - The auto-generated
apigen
API documentation is available at https://codedoc.pub/locomotivemtl/charcoal-cms/master/
Development dependencies
phpunit/phpunit
squizlabs/php_codesniffer
satooshi/php-coveralls
Continuous Integration
Service | Badge | Description |
---|---|---|
Travis | Runs code sniff check and unit tests. Auto-generates API documentation. | |
Scrutinizer | Code quality checker. Also validates API documentation quality. | |
Coveralls | Unit Tests code coverage. | |
Sensiolabs | Another code quality checker, focused on PHP. |
Coding Style
The Charcoal-App module follows the Charcoal coding-style:
- PSR-1
- PSR-2
- PSR-4, autoloading is therefore provided by Composer.
- phpDocumentor comments.
- Read the phpcs.xml file for all the details on code style.
Coding style validation / enforcement can be performed with
composer phpcs
. An auto-fixer is also available withcomposer phpcbf
.
Authors
- Mathieu Ducharme mat@locomotive.ca
Changelog
Unreleased
License
The MIT License (MIT)
Copyright © Locomotive inc.
See Authors.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.