span { width: 5px; height: 5px; background-color: #5b5b5b; } EOL; /** @var CdnAssetUrl */ protected $cdnAssetUrl; /** @var WPFunctions */ protected $wp; /** @var string */ protected $assetsDirectory = ''; public function __construct(CdnAssetUrl $cdnAssetUrl, WPFunctions $wp) { $this->cdnAssetUrl = $cdnAssetUrl; $this->wp = $wp; } abstract public function getName(): string; abstract public function getBody(): array; abstract public function getThumbnailUrl(): string; public function getSettings(): array { return [ 'on_success' => 'message', 'success_message' => '', 'segments' => null, 'segments_selected_by' => 'admin', ]; } public function getStyles(): string { return self::DEFAULT_STYLES; } public function toFormEntity(): FormEntity { $formEntity = new FormEntity($this->getName()); $formEntity->setBody($this->getBody()); $formEntity->setSettings($this->getSettings()); $formEntity->setStyles($this->getStyles()); return $formEntity; } protected function getAssetUrl(string $filename): string { return $this->cdnAssetUrl->generateCdnUrl("form-templates/{$this->assetsDirectory}/$filename"); } protected function replaceLinkTags($source, $link, $attributes = [], $linkTag = false): string { return Helpers::replaceLinkTags($source, $link, $attributes, $linkTag); } }