'; + echo ' | |||
---|---|---|---|
Consent Type | Title | Description | Default | '; + echo '
'; + echo ' | ';
$this->{$fieldConfiguration['renderMethodName']}(array_merge($fieldConfiguration, [
'label_for' => $fieldName,
'value' => $value,
@@ -229,9 +333,11 @@ public function checkboxField( $args ): void
value="1"
/>
+
+ " class="large-text code" rows="" + placeholder="" name=""> @@ -303,8 +410,8 @@ public function optionsPage(): void { $this->settingsUtil->addSubmenuPage( 'options-general.php', - 'GTM Cookies', - 'GTM Cookies', + 'GTM Consent Mode Banner', + 'GTM Consent Mode', 'manage_options' ); } diff --git a/src/Util/OutputUtil.php b/src/Util/OutputUtil.php index c56acbb..2694b5d 100644 --- a/src/Util/OutputUtil.php +++ b/src/Util/OutputUtil.php @@ -1,15 +1,23 @@ [], 'footer' => []]; + private $externalScripts = ['header' => [], 'footer' => []]; public function __construct() { add_action( 'wp_head', [$this, 'wpHead'], 0 ); - add_action( 'wp_footer', [$this, 'wpFooter'], 0 ); + add_action( 'wp_footer', [$this, 'wpFooter'], 1 ); + } + + public function loadExternalScript($script, $footer = true): OutputUtil + { + $this->externalScripts[true === $footer ? 'footer' : 'header'][] = $script; + + return $this; } public function addInlineScript($script, $footer = true): OutputUtil @@ -34,6 +42,12 @@ public function wpHead(): void public function wpFooter(): void { + foreach ($this->externalScripts['footer'] as $script) { + echo '' . "\n"; + } + if (0 === count($this->inlineScripts['footer'])) { echo ''; return; diff --git a/src/Util/SanitizationUtil.php b/src/Util/SanitizationUtil.php index a09f4d2..efcfcdd 100644 --- a/src/Util/SanitizationUtil.php +++ b/src/Util/SanitizationUtil.php @@ -1,6 +1,6 @@ snakeCaseNamespace = GtmCookiesFree::SNAKE_CASE_NAMESPACE; - $this->spineCaseNamespace = GtmCookiesFree::SPINE_CASE_NAMESPACE; + $this->snakeCaseNamespace = GtmConsentModeBanner::SNAKE_CASE_NAMESPACE; + $this->spineCaseNamespace = GtmConsentModeBanner::SPINE_CASE_NAMESPACE; } public function getOption( $optionName) { |