Spaces:
No application file
No application file
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(); | |
} | |
} | |