Skip to content

Commit 9030897

Browse files
committed
0.5.0
1 parent fd7efa3 commit 9030897

File tree

82 files changed

+816
-7858
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+816
-7858
lines changed

Block/Content.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
use Magento\Framework\Profiler;
2424
use Magento\Framework\View\Element\Template;
2525
use Magento\Widget\Block\BlockInterface;
26+
use Magento\Framework\DataObject\IdentityInterface;
2627

27-
class Content extends Template implements BlockInterface
28+
class Content extends Template implements BlockInterface, IdentityInterface
2829
{
2930
/**
3031
* @var ContentInterface[]
@@ -326,4 +327,20 @@ public function __toString()
326327
{
327328
return $this->toHtml();
328329
}
330+
331+
/**
332+
* @inheritDoc
333+
*/
334+
public function getIdentities()
335+
{
336+
$keys = [];
337+
if ($this->currentContentId) {
338+
$keys[] = 'pagebuilder_content_' . $this->currentContentId;
339+
}
340+
if ($this->currentIdentifier) {
341+
$keys[] = 'pagebuilder_content_' . $this->currentIdentifier;
342+
}
343+
344+
return $keys;
345+
}
329346
}

Builder/Base/AbstractCss.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Goomento\PageBuilder\Builder\Managers\Controls;
1313
use Goomento\PageBuilder\Builder\Managers\Icons;
1414
use Goomento\PageBuilder\Builder\Managers\Tags;
15-
use Goomento\PageBuilder\Builder\Modules\Frontend;
1615
use Goomento\PageBuilder\Builder\Modules\Stylesheet;
1716
use Goomento\PageBuilder\Developer;
1817
use Goomento\PageBuilder\Exception\BuilderException;
@@ -208,18 +207,6 @@ public function enqueue()
208207
$frontend->enqueueFont($defaultFont);
209208
}
210209

211-
if (!empty($meta['icons'])) {
212-
$iconsTypes = Icons::getIconManagerTabs();
213-
foreach ($meta['icons'] as $iconFont) {
214-
if (!isset($iconsTypes[ $iconFont ])) {
215-
continue;
216-
}
217-
/** @var Frontend $frontend */
218-
$frontend = ObjectManagerHelper::get(Frontend::class);
219-
$frontend->enqueueFont($iconFont);
220-
}
221-
}
222-
223210
$name = $this->getName();
224211

225212
/**

Builder/Base/AbstractDocument.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function getContainerAttributes()
174174
'class' => 'goomento gmt gmt-' . $this->getModel()->getUniqueIdentity(),
175175
];
176176

177-
if (!StateHelper::isEditorPreviewMode()) {
177+
if (!StateHelper::isCanvasMode()) {
178178
$attributes['data-gmt-settings'] = DataHelper::encode($this->getFrontendSettings());
179179
}
180180

@@ -380,7 +380,7 @@ public function getPreviewUrl()
380380

381381
if (null === $url) {
382382

383-
$url = UrlBuilderHelper::getEditorPreviewUrl(
383+
$url = UrlBuilderHelper::getCanvasUrl(
384384
$this->getModel()->getOriginContent()
385385
);
386386

@@ -637,7 +637,7 @@ public function getLastEdited()
637637
$user = $content->getLastEditorUser();
638638
$displayName = $user ? $user->getName() : __('Automatic');
639639

640-
return __('Updated %1 by %2', DataHelper::timeElapsedString($content->getUpdateTime()), $displayName)->__toString();
640+
return __('Updated by %1', $displayName)->__toString();
641641
}
642642

643643
/**

Builder/Base/AbstractModule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ abstract class AbstractModule extends AbstractBase
3333
*/
3434
public function __clone()
3535
{
36-
throw new \Goomento\PageBuilder\Exception\BuilderException('Something went wrong');
36+
throw new \Exception('Something went wrong');
3737
}
3838

3939
/**

Builder/Css/ContentCss.php

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,6 @@ protected function deleteMeta()
134134
->removeFlag('direct_save');
135135
}
136136

137-
/**
138-
* Get post data.
139-
*
140-
* Retrieve raw post data from the database.
141-
*
142-
*
143-
* @return array ContentCss data.
144-
*/
145-
protected function getData()
146-
{
147-
return $this->model->getElements();
148-
}
149-
150137
/**
151138
* Render CSS.
152139
*
@@ -155,10 +142,10 @@ protected function getData()
155142
*/
156143
protected function renderCss()
157144
{
158-
$data = $this->getData();
145+
$elements = $this->getModel()->getElements();
159146
$elementManager = ObjectManagerHelper::getElementsManager();
160-
if (!empty($data)) {
161-
foreach ($data as $elementData) {
147+
if (!empty($elements)) {
148+
foreach ($elements as $elementData) {
162149
$element = $elementManager->createElementInstance((array) $elementData);
163150
if (!$element) {
164151
continue;
@@ -298,7 +285,7 @@ protected function renderStyles(AbstractElement $element)
298285
*/
299286
protected function useExternalFile()
300287
{
301-
$useInline = (!$this->getModel() instanceof RevisionInterface);
302-
return $useInline && !DataHelper::useInlineCss();
288+
$isRevision = $this->getModel() instanceof RevisionInterface;
289+
return !$isRevision && !DataHelper::useInlineCss();
303290
}
304291
}

Builder/Elements/Section.php

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -458,25 +458,39 @@ protected function registerControls()
458458

459459
$this->endControlsSection();
460460

461-
// Popup Section
462461
$this->startControlsSection(
463-
'section_popup_section',
462+
'section_type_section',
464463
[
465-
'label' => __('Popup'),
464+
'label' => __('Section Type'),
466465
'tab' => Controls::TAB_LAYOUT,
467466
]
468467
);
469468

470469
$this->addControl(
471-
'popup_enabled',
470+
'section_type',
472471
[
473-
'label' => __('Enabled'),
474-
'type' => Controls::SWITCHER,
472+
'label' => __('Type'),
473+
'type' => Controls::SELECT,
474+
'prefix_class' => 'gmt-section-type-',
475475
'default' => '',
476-
'prefix_class' => 'gmt-section-popup-',
477-
'description' => __('Enable this section will hide section on storefront. Use "Call to Action" widget to show this popup.'),
478-
'frontend_available' => true,
479-
'return_value' => 'ok',
476+
'options' => [
477+
'' => __('Default'),
478+
'popup' => __('Popup'),
479+
],
480+
]
481+
);
482+
483+
$this->endControlsSection();
484+
485+
// Popup Section
486+
$this->startControlsSection(
487+
'section_popup_section',
488+
[
489+
'label' => __('Popup'),
490+
'tab' => Controls::TAB_LAYOUT,
491+
'condition' => [
492+
'section_type' => 'popup'
493+
]
480494
]
481495
);
482496

@@ -486,9 +500,6 @@ protected function registerControls()
486500
'type' => Controls::RAW_HTML,
487501
'raw' => __('Note: CSS ID must be placed in tab Advanced > Identify > CSS ID. .'),
488502
'content_classes' => 'gmt-panel-alert gmt-panel-alert-warning',
489-
'condition' => [
490-
'popup_enabled' => 'ok'
491-
]
492503
]
493504
);
494505

@@ -498,10 +509,7 @@ protected function registerControls()
498509
'label' => __('Title'),
499510
'type' => Controls::TEXT,
500511
'frontend_available' => true,
501-
'default' => __('Popup Title'),
502-
'condition' => [
503-
'popup_enabled' => 'ok'
504-
]
512+
'placeholder' => __('Popup Title'),
505513
]
506514
);
507515

@@ -516,9 +524,6 @@ protected function registerControls()
516524
'close' => __('Close Button'),
517525
'confirm' => __('Confirm Button'),
518526
'both' => __('Both'),
519-
],
520-
'condition' => [
521-
'popup_enabled' => 'ok'
522527
]
523528
]
524529
);
@@ -530,8 +535,7 @@ protected function registerControls()
530535
'label' => __('Close Button'),
531536
'type' => Controls::HEADING,
532537
'condition' => [
533-
'popup_buttons' => ['close', 'both'],
534-
'popup_enabled' => 'ok',
538+
'popup_buttons' => ['close', 'both']
535539
]
536540
]
537541
);
@@ -542,11 +546,8 @@ protected function registerControls()
542546
'label' => __('Label'),
543547
'type' => Controls::TEXT,
544548
'frontend_available' => true,
545-
'default' => __('Close'),
546-
'placeholder' => __('Close'),
547549
'condition' => [
548-
'popup_buttons' => ['close', 'both'],
549-
'popup_enabled' => 'ok',
550+
'popup_buttons' => ['close', 'both']
550551
]
551552
]
552553
);
@@ -561,8 +562,7 @@ protected function registerControls()
561562
'title' => __('Add your custom class WITHOUT the dot. e.g: my-class'),
562563
'frontend_available' => true,
563564
'condition' => [
564-
'popup_buttons' => ['close', 'both'],
565-
'popup_enabled' => 'ok',
565+
'popup_buttons' => ['close', 'both']
566566
]
567567
]
568568
);
@@ -574,8 +574,7 @@ protected function registerControls()
574574
'label' => __('Confirm Button'),
575575
'type' => Controls::HEADING,
576576
'condition' => [
577-
'popup_buttons' => ['confirm', 'both'],
578-
'popup_enabled' => 'ok',
577+
'popup_buttons' => ['confirm', 'both']
579578
]
580579
]
581580
);
@@ -586,11 +585,8 @@ protected function registerControls()
586585
'label' => __('Text'),
587586
'type' => Controls::TEXT,
588587
'frontend_available' => true,
589-
'default' => __('Confirm'),
590-
'placeholder' => __('Confirm'),
591588
'condition' => [
592-
'popup_buttons' => ['confirm', 'both'],
593-
'popup_enabled' => 'ok',
589+
'popup_buttons' => ['confirm', 'both']
594590
]
595591
]
596592
);
@@ -603,8 +599,7 @@ protected function registerControls()
603599
'frontend_available' => true,
604600
'placeholder' => __('https://your-link.com'),
605601
'condition' => [
606-
'popup_buttons' => ['confirm', 'both'],
607-
'popup_enabled' => 'ok',
602+
'popup_buttons' => ['confirm', 'both']
608603
]
609604
]
610605
);
@@ -619,8 +614,7 @@ protected function registerControls()
619614
'prefix_class' => '',
620615
'title' => __('Add your custom class WITHOUT the dot. e.g: my-class'),
621616
'condition' => [
622-
'popup_buttons' => ['confirm', 'both'],
623-
'popup_enabled' => 'ok',
617+
'popup_buttons' => ['confirm', 'both']
624618
]
625619
]
626620
);

Builder/Managers/Icons.php

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private static function initTabs()
8282
'displayPrefix' => 'far',
8383
'labelIcon' => 'fab fa-font-awesome-alt',
8484
'ver' => '5.9.0',
85-
'fetchJson' => self::getFaAssetUrl('regular', 'json', false),
85+
'fetchJson' => self::getFaAssetUrl('regular'),
8686
'native' => true,
8787
],
8888
'fa-solid' => [
@@ -92,7 +92,7 @@ private static function initTabs()
9292
'displayPrefix' => 'fas',
9393
'labelIcon' => 'fab fa-font-awesome',
9494
'ver' => '5.9.0',
95-
'fetchJson' => self::getFaAssetUrl('solid', 'json', false),
95+
'fetchJson' => self::getFaAssetUrl('solid'),
9696
'native' => true,
9797
],
9898
'fa-brands' => [
@@ -103,7 +103,7 @@ private static function initTabs()
103103
'displayPrefix' => 'fab',
104104
'labelIcon' => 'fab fa-font-awesome-flag',
105105
'ver' => '5.9.0',
106-
'fetchJson' => self::getFaAssetUrl('brands', 'json', false),
106+
'fetchJson' => self::getFaAssetUrl('brands'),
107107
'native' => true,
108108
],
109109
])->getResult();
@@ -124,22 +124,11 @@ public static function getIconManagerTabs()
124124

125125
/**
126126
* @param $filename
127-
* @param string $extType
128-
* @param bool $addSuffix
129127
* @return string
130128
*/
131-
private static function getFaAssetUrl($filename, $extType = 'css', $addSuffix = true)
129+
private static function getFaAssetUrl($filename)
132130
{
133-
static $isTestMode = null;
134-
if (null === $isTestMode) {
135-
$isTestMode = !!Developer::debug();
136-
}
137-
$url = 'Goomento_PageBuilder/lib/font-awesome/' . $extType . '/' . $filename;
138-
if (!$isTestMode && $addSuffix) {
139-
$url .= '.min';
140-
}
141-
$url .= '.' . $extType;
142-
return UrlBuilderHelper::urlStaticBuilder($url);
131+
return UrlBuilderHelper::getAssetUrlWithParams(sprintf('Goomento_PageBuilder/lib/font-awesome/json/%s.json', $filename));
143132
}
144133

145134
/**
@@ -159,7 +148,6 @@ public static function getIconManagerTabsConfig()
159148
return array_values(array_merge($tabs, self::getIconManagerTabs()));
160149
}
161150

162-
163151
/**
164152
* @param $icon
165153
* @param array $attributes

Builder/Managers/Resolvers.php

Lines changed: 0 additions & 20 deletions
This file was deleted.

Builder/Managers/Schemes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ public function __construct()
215215
{
216216
HooksHelper::addAction('pagebuilder/ajax/register_actions', [ $this,'registerAjaxActions' ]);
217217

218-
$this->components = [
218+
$this->setComponent([
219219
Color::NAME => Color::class,
220220
Typography::NAME => Typography::class,
221221
ColorPicker::NAME => ColorPicker::class,
222-
];
222+
]);
223223
}
224224
}

0 commit comments

Comments
 (0)