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; public function getSettings(): array { return [ 'on_success' => 'message', 'success_message' => '', 'segments' => null, 'segments_selected_by' => 'admin', ]; } public function getThumbnailUrl(): string { if (strpos(get_class($this), 'BelowPages')) { return Env::$assetsUrl . '/img/form_template/belowpage@1130.png'; } if (strpos(get_class($this), 'Popup')) { return Env::$assetsUrl . '/img/form_template/popup@1130.png'; } if (strpos(get_class($this), 'SlideIn')) { return Env::$assetsUrl . '/img/form_template/slidein@1130.png'; } if (strpos(get_class($this), 'FixedBar')) { return Env::$assetsUrl . '/img/form_template/fixedbar@1130.png'; } return Env::$assetsUrl . '/img/form_template/widget@1130.png'; } 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); } }