Skip to content
Code-Schnipsel Gruppen Projekte
Commit f1f32845 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

refactor: bricks can no determine if the brick is cacheable or not - simple contact is not cachable

Übergeordneter 2286cd02
No related branches found
No related tags found
1 Merge Request!9Dev
......@@ -1264,4 +1264,4 @@
</brick>
</bricks>
</quiqqer>
\ No newline at end of file
</quiqqer>
......@@ -85,7 +85,8 @@ public function __construct($params = [])
'width' => '',
'classes' => '',
'frontendTitle' => '',
'hasContent' => 1
'hasContent' => 1,
'cacheable' => 1 // if the brick is cacheable or not
];
$this->setAttributes($default);
......@@ -276,27 +277,29 @@ public function create()
.'/'
.$this->hash;
try {
$data = QUI\Cache\Manager::get($cacheName);
$cssFiles = $data['cssFiles'];
$cssClasses = $data['cssClasses'];
if ($this->getAttribute('cacheable')) {
try {
$data = QUI\Cache\Manager::get($cacheName);
$cssFiles = $data['cssFiles'];
$cssClasses = $data['cssClasses'];
if (\is_array($cssClasses)) {
foreach ($cssClasses as $cssClass) {
$this->addCSSClass($cssClass);
if (\is_array($cssClasses)) {
foreach ($cssClasses as $cssClass) {
$this->addCSSClass($cssClass);
}
}
}
if (\is_array($cssFiles)) {
foreach ($cssFiles as $cssFile) {
QUI\Control\Manager::addCSSFile($cssFile);
if (\is_array($cssFiles)) {
foreach ($cssFiles as $cssFile) {
QUI\Control\Manager::addCSSFile($cssFile);
}
}
}
if (!empty($data['html'])) {
return $data['html'];
if (!empty($data['html'])) {
return $data['html'];
}
} catch (\Exception $Exception) {
}
} catch (\Exception $Exception) {
}
if ($this->getAttribute('type') == 'content') {
......@@ -336,9 +339,7 @@ public function create()
}
foreach ($classes as $class) {
$class = \trim($class);
$_classes[] = $class;
$_classes[] = \trim($class);
}
$_classes = \array_unique($_classes);
......@@ -375,6 +376,10 @@ public function create()
$Control->addCSSClass($this->getAttribute('classes'));
}
if ($Control->existsAttribute('cacheable')) {
$Control->setAttribute('cacheable', $Control->getAttribute('cacheable'));
}
// workaround wegen title bug
// @todo backendTitle einführen und title als frontend Title nutzen (Versionssprung)
$Control->setAttribute('title', $this->getAttribute('frontendTitle'));
......@@ -447,6 +452,10 @@ protected function getControl()
$this->Control = $Control;
if ($this->Control->existsAttribute('cacheable')) {
$this->setAttribute('cacheable', $this->Control->getAttribute('cacheable'));
}
return $Control;
}
......
......@@ -37,6 +37,8 @@ public function __construct($attributes = [])
parent::__construct($attributes);
$this->setAttribute('cacheable', 0);
if (!isset($attributes['showPrivacyPolicyCheckbox'])) {
$Site = $this->getSite();
......
......@@ -125,12 +125,18 @@ public static function parseAreaToArray(\DOMElement $Brick, \DOMXPath $Path)
$name = $Brick->getAttribute('name');
$hasContent = 1;
$cacheable = 1;
if ($Brick->hasAttribute('hasContent')
&& (int)$Brick->getAttribute('hasContent') === 0) {
$hasContent = 0;
}
if ($Brick->hasAttribute('cacheable')
&& (int)$Brick->getAttribute('cacheable') === 0) {
$cacheable = 0;
}
$title = [];
$description = [];
......@@ -154,6 +160,7 @@ public static function parseAreaToArray(\DOMElement $Brick, \DOMXPath $Path)
return [
'control' => $control,
'hasContent' => $hasContent,
'cacheable' => $cacheable,
'name' => $name,
'title' => $title,
'description' => $description,
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren