CMS overview

Centra includes a lightweight CMS module that can be optionally activated. The CMS is fully headless and can be useful for applications when it is desirable to avoid having to integrate a full-scale CMS. The lightweight CMS is well-aligned to the e-commerce functionality in Centra and offers full multi-language support, but it does not support different editor roles or content version management.

This is how you set up the CMS-settings for your store.

The Centra CMS is based on a structure divided into the following tree:

Sections

The different sections contain a collection of articles. A section can be reused across stores but it’s often preferred to have sections set up specific to one store.

Articles

Each section contains multiple articles.

Parts

Each article has multiple parts.

One part can have different sorts of Part templates.

Slots

A part template can have multiple slots.

Each slot has different Slot properties.

All these different levels are dynamic and can handle multiple properties.

The structure is based on this concept:

  • You can have multiple sections, and in each section you can have multiple articles.
  • You can have multiple parts in an article, and each part has a template.
  • Each template can have multiple slots, and each slot has different settings depending on the slot type.

Then, we have a few different types of slots:

Sections

This is the core structure of sections:

1
2
3
4
5
<?php
$usr_conf['CMS_CONF']['SECTIONS'] = [
  "info" => ['BLOG ENTRY', 'BLOG', 'settings' => []],
  "news" => ['PAGE', 'PAGES', 'settings' => []],
];

For each section, the key for each element (ex: info and news) is the ID of the section. The array consists of the following data:

Index Description Example
0 Section in singular. PAGE
1 Section in plural. PAGES
setting Section settings for this section. ['template'=>'default_template', 'parts'=>1]

Section settings

The section settings define how the section should look, like and behave. The following settings are possible to set per section:

parts

int/boolean
optional

Default true. Max amount of parts allowed per article for this section.

  • true means unlimited.
  • 2 means two parts allowed.
  • 0 means no parts at all.

template

string
optional

Default empty. Default template selected when creating a new article.

Template with ID default-template will be selected per default when:

'template' => 'default-template'

hide_forms

array
optional

Default empty. The ability to hide article fields. [key]=>true/false where key is the name of the field.

This will hide the tags and the image-field:

'hide_forms' => ['art_tags' => true, 'art_mediasrc' => true]

Articles

The default view when creating articles inside a section looks like this:

https://docs.centra.com/_images/create-view.png

The following keys and API-fields correspond to the image above. The key-field can be used for section settings to hide fields in the section. The API-field is what you get when querying the API.

Field key API-field Description
Title art_title "title": "" The title of the article.
Tags art_tags "tags": [] List of tags connected to the article.
List image art_mediasrc "listImage": "https://..." Listing image for this article.
Category art_category "categories": [] Product categories connected to this article.
Brand art_brand "brands": [] Product brands connected to this article.
Author art_author "authorName": "" Name of the author for this article.
Location art_author_location N/A Location field for the author.
Preheading art_preheading "preHeading": "" Content before the header. Could also be used for other meta data.
Subheading art_subheading "subHeading": "" Content after the header. Could also be used for other meta data.
Meta keywords art_meta_keywords "metaKeywords": "" Meta keyword field for the article.
Meta description art_meta_description "metaDescription": "" Meta description field for the article.
Relations art_relations "relatedArticles": [] List of articles related to this article.
Parts   "parts": [] List of the parts for the article.

Parts

Each part in an article can have a status (being enabled or not), a sort and a template set. Each part looks like this in the API:

1
2
3
4
5
{
  "template": "category_page",
  "slots": [
  ]
}

Part Templates

Part templates are set in the config using ['CMS_CONF']['TEMPLATES'] in config.php:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
$usr_conf['CMS_CONF']['TEMPLATES'] = [
 "info_item" => [
  "template" => "info_item",
  "name" => "Standard Page",
  "slots" => [
   [
     "name" => "header",
     "type" => "textfield",
     "desc" => "Header",
   ],
   [
     "name" => "pre_content",
     "type" => "text",
     "desc" => "Pre content",
     "class" => "",
   ],
   [
     "name" => "pre_image",
     "type" => "image",
     "desc" => "Pre image",
   ],
   [
     "name" => "content",
     "type" => "text",
     "desc" => "Content",
     "class" => "double",
   ],
  ]
 ],
];

In this case, this template will look like this:

https://docs.centra.com/_images/cms-info_item-template.png

And in the API, the data will look like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
  "slots": {
    "header": {
      "slot": "header",
      "type": "textfield",
      "text": "AA"
    },
    "pre_content": {
      "slot": "pre_content",
      "type": "text",
      "text": "BB"
    },
    "pre_image": {
      "slot": "pre_image",
      "type": "image",
      "url": "https://demo.centracdn.net/client/dynamic/articles/costa-rican-frog_8712.jpg",
      "width": "280",
      "height": "210",
      "linkToUrl": null,
      "title": null,
      "description": "",
      "descriptionRaw": null,
      "class": null,
      "sizes": {
        "0": {
          "url": "https://demo.centracdn.net/client/dynamic/articles/costa-rican-frog_8712.jpg",
          "width": "280",
          "height": "210"
        },
        "medium": {
          "url": "https://demo.centracdn.net/client/dynamic/articles/medium-costa-rican-frog_8712.jpg",
          "width": "0",
          "height": "1200"
        },
        "original": {
          "url": "https://demo.centracdn.net/client/dynamic/articles/original-costa-rican-frog_8712.jpg",
          "width": 0,
          "height": 0
        }
      }
    },
    "content": {
      "slot": "content",
      "type": "text",
      "text": "CC"
    }
  }
}

Slots

The standard fields for each slot that needs to exist in the config, are name, desc and type.

For example:

1
2
3
4
5
[
  "name" => "pre_content",
  "type" => "text",
  "desc" => "Pre content",
],

Will create a simple text field, and the key pre_content and the description Pre content will show up as the title inside the Centra CMS.

You can select different types of Slot properties for each slot.