feat: VivesPOS landing on Winter CMS 1.2 — theme + plugin + Dockerfile
Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
- Base: wintercms/winter branch 1.2 (full framework) - Theme vivespos: Canvas 7 + Bootstrap 5 CDN, custom CSS - Layout: deferred GTM/GA4 tracking, JSON-LD SoftwareApplication - Partials: hero (offline-first), features, modes (offline/nube toggle), screenshots, pricing (3 planes), comparison, FAQ, CTA - Plugin VivesPOS.Site with ContactForm - Dockerfile: PHP 8.2 Apache, port 80, healthcheck - Added winter/wn-pages, blog, sitemap, seo plugins - Active theme set to vivespos
This commit is contained in:
85
modules/cms/classes/Meta.php
Normal file
85
modules/cms/classes/Meta.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php namespace Cms\Classes;
|
||||
|
||||
use Yaml;
|
||||
|
||||
/**
|
||||
* The CMS meta file class, used for interacting with YAML files within the Halcyon datasources
|
||||
*
|
||||
* @package winter\wn-cms-module
|
||||
* @author Luke Towers
|
||||
*/
|
||||
class Meta extends CmsObject
|
||||
{
|
||||
/**
|
||||
* @var string The container name associated with the model, eg: pages.
|
||||
*/
|
||||
protected $dirName = 'meta';
|
||||
|
||||
/**
|
||||
* @var array Cache store used by parseContent method.
|
||||
*/
|
||||
protected $contentDataCache;
|
||||
|
||||
/**
|
||||
* @var array Allowable file extensions.
|
||||
*/
|
||||
protected $allowedExtensions = ['yaml'];
|
||||
|
||||
/**
|
||||
* @var string Default file extension.
|
||||
*/
|
||||
protected $defaultExtension = 'yaml';
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
|
||||
// Bind data processing to model events
|
||||
$this->bindEvent('model.beforeSave', function () {
|
||||
$this->content = $this->renderContent();
|
||||
});
|
||||
$this->bindEvent('model.afterFetch', function () {
|
||||
$this->attributes = array_merge($this->attributes, $this->parseContent());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the content attribute to an array of menu data.
|
||||
* @return array|null
|
||||
*/
|
||||
protected function parseContent()
|
||||
{
|
||||
if ($this->contentDataCache !== null) {
|
||||
return $this->contentDataCache;
|
||||
}
|
||||
|
||||
$parsedData = Yaml::parse($this->content);
|
||||
|
||||
if (!is_array($parsedData)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->contentDataCache = $parsedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the meta data as a content string in YAML format.
|
||||
* @return string
|
||||
*/
|
||||
protected function renderContent()
|
||||
{
|
||||
return Yaml::render($this->settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile the content for this CMS object, used by the theme logger.
|
||||
* @return string
|
||||
*/
|
||||
public function toCompiled()
|
||||
{
|
||||
return $this->renderContent();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user