Initial commit: CloudOps infrastructure platform
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MauticPlugin\GrapesJsBuilderBundle\Integration;
|
||||
|
||||
use Mautic\IntegrationsBundle\Exception\IntegrationNotFoundException;
|
||||
use Mautic\IntegrationsBundle\Helper\IntegrationsHelper;
|
||||
use Mautic\PluginBundle\Entity\Integration;
|
||||
|
||||
class Config
|
||||
{
|
||||
public function __construct(
|
||||
private IntegrationsHelper $integrationsHelper,
|
||||
) {
|
||||
}
|
||||
|
||||
public function isPublished(): bool
|
||||
{
|
||||
try {
|
||||
$integration = $this->getIntegrationEntity();
|
||||
|
||||
return (bool) $integration->getIsPublished() ?: false;
|
||||
} catch (IntegrationNotFoundException) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed[]
|
||||
*/
|
||||
public function getFeatureSettings(): array
|
||||
{
|
||||
try {
|
||||
$integration = $this->getIntegrationEntity();
|
||||
|
||||
return $integration->getFeatureSettings() ?: [];
|
||||
} catch (IntegrationNotFoundException) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws IntegrationNotFoundException
|
||||
*/
|
||||
public function getIntegrationEntity(): Integration
|
||||
{
|
||||
$integrationObject = $this->integrationsHelper->getIntegration(GrapesJsBuilderIntegration::NAME);
|
||||
|
||||
return $integrationObject->getIntegrationConfiguration();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MauticPlugin\GrapesJsBuilderBundle\Integration;
|
||||
|
||||
use Mautic\IntegrationsBundle\Integration\BasicIntegration;
|
||||
use Mautic\IntegrationsBundle\Integration\ConfigurationTrait;
|
||||
use Mautic\IntegrationsBundle\Integration\Interfaces\BasicInterface;
|
||||
|
||||
class GrapesJsBuilderIntegration extends BasicIntegration implements BasicInterface
|
||||
{
|
||||
use ConfigurationTrait;
|
||||
|
||||
public const NAME = 'grapesjsbuilder';
|
||||
|
||||
public const DISPLAY_NAME = 'GrapesJS';
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return self::NAME;
|
||||
}
|
||||
|
||||
public function getDisplayName(): string
|
||||
{
|
||||
return self::DISPLAY_NAME;
|
||||
}
|
||||
|
||||
public function getIcon(): string
|
||||
{
|
||||
return 'plugins/GrapesJsBuilderBundle/Assets/img/grapesjsbuilder.png';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MauticPlugin\GrapesJsBuilderBundle\Integration\Support;
|
||||
|
||||
use Mautic\IntegrationsBundle\Integration\Interfaces\BuilderInterface;
|
||||
use MauticPlugin\GrapesJsBuilderBundle\Integration\GrapesJsBuilderIntegration;
|
||||
|
||||
class BuilderSupport extends GrapesJsBuilderIntegration implements BuilderInterface
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private array $featuresSupported = ['email', 'page'];
|
||||
|
||||
public function isSupported(string $featureName): bool
|
||||
{
|
||||
return in_array($featureName, $this->featuresSupported);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MauticPlugin\GrapesJsBuilderBundle\Integration\Support;
|
||||
|
||||
use Mautic\IntegrationsBundle\Integration\DefaultConfigFormTrait;
|
||||
use Mautic\IntegrationsBundle\Integration\Interfaces\ConfigFormInterface;
|
||||
use MauticPlugin\GrapesJsBuilderBundle\Integration\GrapesJsBuilderIntegration;
|
||||
|
||||
class ConfigSupport extends GrapesJsBuilderIntegration implements ConfigFormInterface
|
||||
{
|
||||
use DefaultConfigFormTrait;
|
||||
}
|
||||
Reference in New Issue
Block a user