2017 © Pedro Pelรกez
 

library charcoal-cms

Charcoal CMS (Content Management System) Module

image

locomotivemtl/charcoal-cms

Charcoal CMS (Content Management System) Module

  • Monday, July 30, 2018
  • by mducharme
  • Repository
  • 13 Watchers
  • 17 Stars
  • 3,613 Installations
  • HTML
  • 3 Dependents
  • 0 Suggesters
  • 3 Forks
  • 2 Open issues
  • 53 Versions
  • 5 % Grown

The README.md

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., (*1)

This module is heavily dependant on charcoal-object (and therefore charcoal-core) which provides the base Content class the CMS objects are dependant on, as well as many trait / interface behaviors., (*2)

How to install

The preferred (and only supported) way of installing charcoal-cms is with composer:, (*3)

โ˜… composer require locomotivemtl/charcoal-cms

For a complete, ready-to-use project, start from the charcoal project boilerplate:, (*4)

โ˜… composer create-project locomotivemtl/charcoal-project-boilerplate:@dev --prefer-source

Dependencies

Objects

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)., (*5)

Types of sections:, (*6)

  • 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, (*7)

Sections are standard Charcoal Model, meaning they are describable with a Metadata object (which define a map of properties) and storable with a Source object., (*8)

Base section properties:, (*9)

Interface Name L10n Type Description
Section section_type choice
Section title โœ” string
Section subtitle โœ” html
Section summary โœ” html
Section image โœ” image
Section template_ident string
Section template_options structure
Section content โœ” html
Section attachments โœ” multi-object
Section external_url โœ” url For external URLs. Note that all content-related properties are ignored if this property is set.
Content id id The model's key.
Content active bool Inactive events should not appear in public API / frontend.
Content position int Default order property.
Authorable created_by string Admin user.
Authorable last_modified_by string Admin user.
Authorable required_acl_permissions array To do...
Timestampable created date-time
Timestampable last_modified date-time
Hierarchical master object SectionInterface.
Routable slug โœ” string Permalink. Auto-generated from title.

Interfaces

From model:, (*10)

  • Describable: The objects can be defined by Metadata.
  • Storable: Objects have unique IDs and can be stored in storage / database.

From content:, (*11)

  • Content: A "managed" charcoal model (describable with metadata / storable).
  • Authorable: Creation and modification user (admin) are kept in the storage.
  • Revisionable: Copy of changes will be kept upon each object update in the storage.
  • Timestampable: Creation and modification time are kept into the storage.

From charcoal-object, (*12)

  • Hierarchicale: The objects can be stacked hierarchically.
  • ~~Publishable: Objects have publish status, date and expiry. Allows moderation.~~
  • Routable: Objects are reachable through a URL.

From charcoal-cms:, (*13)

  • Metatag: The objects have meta-information for SEO purpose.
  • Searchable: Extra keywords can be used to help search engine.
  • Templateable: The objects can be rendered with a template / controller / config combo.

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., (*14)

Tag object

Tag objects link any objects together by providing an extra taxonomy layer. Tags may also be used to enhance internal search engines., (*15)

CMS objects

Event object

Charcoal Event is a specialized content object to describe an event, which typically happens at a given date in a certain location., (*16)

Base events properties:, (*17)

Interface Name L10n Type Description
Event title โœ” string
Event subtitle โœ” html
Event summary โœ” html
Event content โœ” html
Event image โœ” image
Event start_date date-time
Event end_date date-time
Event info_url โœ” image
Content id id The model's key.
Content active bool Inactive events should not appear in public API / frontend.
Content position int Default order property.
Authorable created_by string Admin user.
Authorable last_modified_by string Admin user.
Authorable required_acl_permissions array To do...
Timestampable created date-time
Timestampable last_modified date-time
Categorizable category โœ” object EventCategory, or custom.
Publishable publishDate date-time
Publishable expiryDate date-time
Publishable publishStatus string draft, pending, or published.
Routable slug โœ” string Permalink. Auto-generated from title.
Metatag meta_title โœ” string
Metatag meta_description โœ” string
Metatag meta_image โœ” image
Metatag meta_author โœ” string
Templateable controller_ident string
Templateable template_ident string
Templateable template_options structure

Interfaces

From model:, (*18)

  • Describable: The objects can be defined by Metadata.
  • Storable: Objects have unique IDs and can be stored in storage / database.

From content:, (*19)

  • Content: A "managed" charcoal model (describable with metadata / storable).
  • Authorable: Creation and modification user (admin) are kept in the storage.
  • Revisionable: Copy of changes will be kept upon each object update in the storage.
  • Timestampable: Creation and modification time are kept into the storage.

From charcoal-object:, (*20)

  • Categorizable: The objects can be put into a category.
  • Publishable: Objects have publish status, date and expiry. Allows moderation.
  • Routable: Objects are reachable through a URL.

From charcoal-cms:, (*21)

  • Metatag: The objects have meta-information for SEO purpose.
  • Searchable: Extra keywords can be used to help search engine.
  • Templateable: The objects can be rendered with a template / controller / config combo.

Extending the event object

The \Charcoal\Cms\Event object is final. To extend, use the \Charcoal\Cms\AbstractEvent base object instead, to make sure no metadata conflicts arise., (*22)

Event categories

Event category objects are simple charcoal/object/category used to group / categorize events. The default type is Charcoal\Cms\EventCategory., (*23)

Events implement the Categorizable interface, from charcoal-object., (*24)

FAQ object

FAQ objects are a special content type that is split in a "question" / "answer" format., (*25)

FAQ categories

FAQ category objects are simple charcoal/object/category used to group / categorize FAQ objects. The default type is Charcoal\Cms\FaqCategory., (*26)

FAQs implement the Categorizable interface, from charcoal-object., (*27)

News object

News object are a special content type that with a specific news date., (*28)

Base news properties:, (*29)

Interface Name L10n Type Description
News title โœ” string
News subtitle โœ” html
News summary โœ” html
News content โœ” html
News image โœ” image
News news_date date-time
News info_url โœ” image
Content id id The model's key.
Content active bool Inactive news should not appear in public API / frontend.
Content position int Default order property.
Authorable created_by string Admin user.
Authorable last_modified_by string Admin user.
Authorable required_acl_permissions array To do...
Timestampable created date-time
Timestampable last_modified date-time
Categorizable category โœ” object NewsCategory, or custom.
Publishable publishDate date-time
Publishable expiryDate date-time
Publishable publishStatus string draft, pending, or published.
Routable slug โœ” string Permalink. Auto-generated from title.
Metatag meta_title โœ” string
Metatag meta_description โœ” string
Metatag meta_image โœ” image
Metatag meta_author โœ” string
Templateable controller_ident string
Templateable template_ident string
Templateable template_options structure

Interfaces

From model:, (*30)

  • Describable: The objects can be defined by Metadata.
  • Storable: Objects have unique IDs and can be stored in storage / database.

From content:, (*31)

  • Content: A "managed" charcoal model (describable with metadata / storable).
  • Authorable: Creation and modification user (admin) are kept in the storage.
  • Revisionable: Copy of changes will be kept upon each object update in the storage.
  • Timestampable: Creation and modification time are kept into the storage.

From charcoal-object:, (*32)

  • Categorizable: The objects can be put into a category.
  • Publishable: Objects have publish status, date and expiry. Allows moderation.
  • Routable: Objects are reachable through a URL.

From charcoal-cms:, (*33)

  • Metatag: The objects have meta-information for SEO purpose.
  • Searchable: Extra keywords can be used to help search engine.
  • Templateable: The objects can be rendered with a template / controller / config combo.

Extending the news object

The \Charcoal\Cms\News object is final. To extend, use the \Charcoal\Cms\AbstractNews base object instead, to make sure no metadata conflicts arise., (*34)

News categories

News category objects are simple charcoal/object/category used to group / categorize events. The default type is Charcoal\Cms\NewsCategory., (*35)

News implement the Categorizable interface, from charcoal-object., (*36)

Development

To install the development environment:, (*37)

$ composer install --prefer-source

API documentation

Development dependencies

  • phpunit/phpunit
  • squizlabs/php_codesniffer
  • satooshi/php-coveralls

Continuous Integration

Service Badge Description
Travis Build Status Runs code sniff check and unit tests. Auto-generates API documentation.
Scrutinizer Scrutinizer Code Quality Code quality checker. Also validates API documentation quality.
Coveralls Coverage Status Unit Tests code coverage.
Sensiolabs SensioLabsInsight Another code quality checker, focused on PHP.

Coding Style

The charcoal-cms module follows the Charcoal coding-style:, (*38)

Coding style validation / enforcement can be performed with composer phpcs. An auto-fixer is also available with composer phpcbf., (*39)

Authors

License

Charcoal is licensed under the MIT license. See LICENSE for details., (*40)

The Versions