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:
93
modules/cms/classes/PartialStack.php
Normal file
93
modules/cms/classes/PartialStack.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php namespace Cms\Classes;
|
||||
|
||||
/**
|
||||
* Manager class for stacking nested partials and keeping track
|
||||
* of their components. Partial "objects" store the components
|
||||
* used by that partial for deferred retrieval.
|
||||
*
|
||||
* @package winter\wn-cms-module
|
||||
* @author Alexey Bobkov, Samuel Georges
|
||||
*/
|
||||
class PartialStack
|
||||
{
|
||||
/**
|
||||
* @var array The current partial "object" being rendered.
|
||||
*/
|
||||
public $activePartial;
|
||||
|
||||
/**
|
||||
* @var array Collection of previously rendered partial "objects".
|
||||
*/
|
||||
protected $partialStack = [];
|
||||
|
||||
/**
|
||||
* Partial entry point, appends a new partial to the stack.
|
||||
*/
|
||||
public function stackPartial()
|
||||
{
|
||||
if ($this->activePartial !== null) {
|
||||
array_unshift($this->partialStack, $this->activePartial);
|
||||
}
|
||||
|
||||
$this->activePartial = [
|
||||
'components' => []
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Partial exit point, removes the active partial from the stack.
|
||||
*/
|
||||
public function unstackPartial()
|
||||
{
|
||||
$this->activePartial = array_shift($this->partialStack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a component to the active partial stack.
|
||||
*/
|
||||
public function addComponent($alias, $componentObj)
|
||||
{
|
||||
array_push($this->activePartial['components'], [
|
||||
'name' => $alias,
|
||||
'obj' => $componentObj
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a component by its alias from the partial stack.
|
||||
*/
|
||||
public function getComponent($name)
|
||||
{
|
||||
if (!$this->activePartial) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$component = $this->findComponentFromStack($name, $this->activePartial);
|
||||
if ($component !== null) {
|
||||
return $component;
|
||||
}
|
||||
|
||||
foreach ($this->partialStack as $stack) {
|
||||
$component = $this->findComponentFromStack($name, $stack);
|
||||
if ($component !== null) {
|
||||
return $component;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Locates a component by its alias from the supplied stack.
|
||||
*/
|
||||
protected function findComponentFromStack($name, $stack)
|
||||
{
|
||||
foreach ($stack['components'] as $componentInfo) {
|
||||
if ($componentInfo['name'] == $name) {
|
||||
return $componentInfo['obj'];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user