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:
129
modules/cms/classes/ComponentHelpers.php
Normal file
129
modules/cms/classes/ComponentHelpers.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php namespace Cms\Classes;
|
||||
|
||||
use Lang;
|
||||
|
||||
/**
|
||||
* Defines some component helpers for the CMS UI.
|
||||
*
|
||||
* @package winter\wn-system-module
|
||||
* @author Alexey Bobkov, Samuel Georges
|
||||
*/
|
||||
class ComponentHelpers
|
||||
{
|
||||
/**
|
||||
* Returns a component property configuration as a JSON string or array.
|
||||
* @param mixed $component The component object
|
||||
* @param boolean $addAliasProperty Determines if the Alias property should be added to the result.
|
||||
* @param boolean $returnArray Determines if the method should return an array.
|
||||
* @return string
|
||||
*/
|
||||
public static function getComponentsPropertyConfig($component, $addAliasProperty = true, $returnArray = false)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
if ($addAliasProperty) {
|
||||
$property = [
|
||||
'property' => 'oc.alias',
|
||||
'title' => Lang::get('cms::lang.component.alias'),
|
||||
'description' => Lang::get('cms::lang.component.alias_description'),
|
||||
'type' => 'string',
|
||||
'validationPattern' => '^(@)?[a-zA-Z]+[0-9a-z\_]*$',
|
||||
'validationMessage' => Lang::get('cms::lang.component.validation_message'),
|
||||
'required' => true,
|
||||
'showExternalParam' => false
|
||||
];
|
||||
$result[] = $property;
|
||||
}
|
||||
|
||||
$properties = $component->defineProperties();
|
||||
if (is_array($properties)) {
|
||||
foreach ($properties as $name => $params) {
|
||||
$property = [
|
||||
'property' => $name,
|
||||
'title' => array_get($params, 'title', $name),
|
||||
'type' => array_get($params, 'type', 'string'),
|
||||
'showExternalParam' => array_get($params, 'showExternalParam', true)
|
||||
];
|
||||
|
||||
foreach ($params as $name => $value) {
|
||||
if (isset($property[$name])) {
|
||||
continue;
|
||||
}
|
||||
$property[$name] = $value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Translate human values
|
||||
*/
|
||||
$translate = ['title', 'description', 'options', 'group', 'validationMessage'];
|
||||
foreach ($property as $name => $value) {
|
||||
if (!in_array($name, $translate)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_array($value)) {
|
||||
array_walk($property[$name], function (&$_value, $key) {
|
||||
$_value = Lang::get($_value);
|
||||
});
|
||||
}
|
||||
else {
|
||||
$property[$name] = Lang::get($value);
|
||||
}
|
||||
}
|
||||
|
||||
$result[] = $property;
|
||||
}
|
||||
}
|
||||
|
||||
if ($returnArray) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
return json_encode($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a component property values.
|
||||
* @param mixed $component The component object
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getComponentPropertyValues($component)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
$result['oc.alias'] = $component->alias;
|
||||
|
||||
$properties = $component->defineProperties();
|
||||
foreach ($properties as $name => $params) {
|
||||
$result[$name] = $component->property($name);
|
||||
}
|
||||
|
||||
return json_encode($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a component name.
|
||||
* @param mixed $component The component object
|
||||
* @return string
|
||||
*/
|
||||
public static function getComponentName($component)
|
||||
{
|
||||
$details = $component->componentDetails();
|
||||
$name = $details['name'] ?? 'cms::lang.component.unnamed';
|
||||
|
||||
return Lang::get($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a component description.
|
||||
* @param mixed $component The component object
|
||||
* @return string
|
||||
*/
|
||||
public static function getComponentDescription($component)
|
||||
{
|
||||
$details = $component->componentDetails();
|
||||
$name = $details['description'] ?? 'cms::lang.component.no_description';
|
||||
|
||||
return Lang::get($name);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user