Skip to content

MelisCmsNews

News / blog posts for Melis sites, plus the front-office templating plugins that display them. Package melisplatform/melis-cms-news.

Purpose

MelisCmsNews adds a News tool to the backoffice where editors create and manage news/blog posts (title, texts, paragraphs, images, documents, categories, tags, sites, SEO and a publish / unpublish window). Posts are surfaced on the front office through three drag-and-drop templating plugins (latest news, news list, single news). It also ships SEO routing so each post gets its own URL, a publication workflow (validation comments), and a GDPR auto-delete hook.

Enable it

It is a standard Laminas module listed in config/melis.module.load.php (it ships enabled in the skeleton). To toggle it, ensure 'MelisCmsNews' is present in that array. It depends on melis-core, melis-engine, melis-front and melis-cms (see composer.json), and integrates optionally with melis-cms-slider, melis-cms-category2 and melis-cms-comments when those are installed. See Module reference and Build a site.

Key services

Registered as service_manager aliases in config/module.config.php.

Service aliasRole
MelisCmsNewsServiceMain CRUD/query service for posts. Methods: getNewsList(...) (filter by status, lang, date window, site, search; supports paging + count), getNewsById($newsId, $langId), getNewsByIdArray(array $ids, $langId, $where), saveNews($news, $newsId), deleteNewsById($newsId), getPostText($newsId), getNewsDetailsPagesBySite($siteId).
MelisCmsNewsSeoServicePer-post SEO + URL building. Methods: getPageLink($idPage, $newsId, $absolute), getSeoData($newsId, $idPage), updateTitleAndDescription($newsId, $idPage, $contentGenerated).

Table gateways are also aliased: MelisCmsNewsTable, MelisCmsNewsTextsTable, MelisCmsNewsSeoTable, MelisCmsNewsCategoryTable, MelisCmsNewsTagsTable.

Backoffice

The tool is mounted under the CMS tools tree (app.interface.php) as section meliscms_news_tool_section (icon fa-newspaper-o), with the list interface meliscmsnews_list and the post editor meliscmsnews. Controllers (in config/module.config.php):

ControllerRole
MelisCmsNews\Controller\MelisCmsNewsListThe list / table tool (renderNewsListData AJAX feed, filters, action buttons).
MelisCmsNews\Controller\MelisCmsNewsThe post editor: properties, categories, tags, sites, media, texts, SEO and preview tabs.
MelisCmsNews\Controller\MelisCmsNewsWorkflowCommentsWorkflow validation comments / timeline for a post.

The list table (app.tools.php, tool key meliscmsnews_list_table) shows columns cnews_id, cnews_status, cnews_title, cnews_creation_date, cnews_publish_date, cnews_unpublish_date and the site label, with info / delete / workflow row actions. A DashboardLatestComments controller plugin extends the MelisCmsComments dashboard widget. See Create a tool.

Front office

Three templating plugins (controller plugins extending MelisTemplatingPlugin) — see Plugins. Each has a matching view helper alias for direct use in .phtml.

Plugin (controller plugin)XML key (pluginXmlDbKey)View helperFront templateRole
MelisCmsNewsLatestNewsPluginMelisCmsNewsLatestNewsMelisCmsNewsLatestPluginMelisCmsNews/latestnewsThe latest N posts for a site/page.
MelisCmsNewsListNewsPluginMelisCmsNewsListNewsMelisCmsNewsListPluginMelisCmsNews/listnewsPaginated/filtered list of posts.
MelisCmsNewsShowNewsPluginMelisCmsNewsShowNewsMelisCmsNewsShowNewsPluginMelisCmsNews/shownewsA single post (detail page).

All three share configPluginKey = 'meliscmsnews'. SEO-friendly URLs and per-post meta are wired through listeners (MelisCmsNewsSEORouteListener, MelisCmsNewsRenderPageListener, MelisCmsNewsMetaPageListener, MelisCmsNewsSeoRedirectUrlListener), all attached in src/Module.php.

Database tables

Created by the dbdeploy deltas under install/dbdeploy/.

TableRole
melis_cms_newsCore post row (status, dates, site, relations).
melis_cms_news_textsPer-language texts/paragraphs for a post.
melis_cms_news_seoPer-post SEO data (title, description, URL).
melis_cms_news_categoryNews categories.

Example

Render the 3 most recent published posts of the current language directly from a view, via the list service:

php
// In a controller / service that has the service manager
$newsService = $sm->get('MelisCmsNewsService');
$latest = $newsService->getNewsList(
    'published',   // status
    $langId,       // langId
    null, null, null, null, // date filters
    false,         // unpublishFilter
    0, 3,          // start, limit
    'cnews_publish_date', 'DESC'
);

For pages, prefer dropping the Latest news / News list / Show news templating plugins into a MelisDragDropZone rather than calling the service by hand — see Plugins.

Key files

ConcernPath
Module config (services, controllers, plugins, view helpers)vendor/melisplatform/melis-cms-news/config/module.config.php
Backoffice tool treevendor/melisplatform/melis-cms-news/config/app.interface.php
List table configvendor/melisplatform/melis-cms-news/config/app.tools.php
Main servicevendor/melisplatform/melis-cms-news/src/Service/MelisCmsNewsService.php
SEO servicevendor/melisplatform/melis-cms-news/src/Service/MelisCmsNewsSeoService.php
Templating pluginsvendor/melisplatform/melis-cms-news/src/Controller/Plugin/
Plugin configsvendor/melisplatform/melis-cms-news/config/plugins/
Listeners (SEO routing, GDPR, workflow)vendor/melisplatform/melis-cms-news/src/Listener/
Install deltasvendor/melisplatform/melis-cms-news/install/dbdeploy/