From a642aae5e37f3011c3701e0e5609e111e38b3b2d Mon Sep 17 00:00:00 2001 From: zarocknz Date: Thu, 20 Dec 2018 14:50:16 +1300 Subject: [PATCH 1/2] Update to work with SilverStripe 4 --- CHANGELOG.md | 4 ++++ LICENSE.md | 2 +- README.md | 8 ++++---- _config/config.yml | 7 ++----- composer.json | 6 +++--- {code => src}/extensions/GASiteConfigExtension.php | 6 ++++++ {code => src}/formfields/GACodeField.php | 4 ++++ .../{ => Chrometoaster/GaGtmSinglefield}/GA_GTM_body.ss | 4 ++-- .../{ => Chrometoaster/GaGtmSinglefield}/GA_GTM_head.ss | 4 ++-- .../GaGtmSinglefield/Includes}/GA_body.ss | 0 .../GaGtmSinglefield/Includes}/GA_head.ss | 0 .../GaGtmSinglefield/Includes}/GTM_body.ss | 0 .../GaGtmSinglefield/Includes}/GTM_head.ss | 0 13 files changed, 28 insertions(+), 17 deletions(-) rename {code => src}/extensions/GASiteConfigExtension.php (86%) rename {code => src}/formfields/GACodeField.php (92%) rename templates/{ => Chrometoaster/GaGtmSinglefield}/GA_GTM_body.ss (57%) rename templates/{ => Chrometoaster/GaGtmSinglefield}/GA_GTM_head.ss (57%) rename templates/{includes => Chrometoaster/GaGtmSinglefield/Includes}/GA_body.ss (100%) rename templates/{includes => Chrometoaster/GaGtmSinglefield/Includes}/GA_head.ss (100%) rename templates/{includes => Chrometoaster/GaGtmSinglefield/Includes}/GTM_body.ss (100%) rename templates/{includes => Chrometoaster/GaGtmSinglefield/Includes}/GTM_head.ss (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03f171a..039727c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [2.0.0] + +Update to work with SilverStripe 4. + ## [1.0.0] Initial module release. diff --git a/LICENSE.md b/LICENSE.md index e78cbee..9f4a718 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) 2017, Chrometoaster New Media Ltd. +Copyright (c) 2018, Chrometoaster Ltd. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index 789b5fa..09c6df5 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Comes with Google snippets that need to be included in your theme's templates. ## Requirements -* SilverStripe 3.1 and above +* SilverStripe 4.0 and above ## Installation @@ -33,17 +33,17 @@ Place two template includes into your theme's main template, e.g. Page.ss. $Title - <% include GA_GTM_head %> + <% include Chrometoaster\GaGtmSinglefield\GA_GTM_head %> ``` #### Body -`<% include GA_GTM_body %>` directly after the opening `` tag: +`<% include Chrometoaster\GaGtmSinglefield\GA_GTM_body %>` directly after the opening `` tag: ```html - <% include GA_GTM_body %> + <% include Chrometoaster\GaGtmSinglefield\GA_GTM_body %> ``` diff --git a/_config/config.yml b/_config/config.yml index db86b5b..fafaf80 100644 --- a/_config/config.yml +++ b/_config/config.yml @@ -1,9 +1,6 @@ --- Name: ga-gtm-singlefield -After: - - 'framework/*' - - 'cms/*' --- -SiteConfig: +SilverStripe\SiteConfig\SiteConfig: extensions: - - GASiteConfigExtension + - Chrometoaster\GaGtmSinglefield\Extensions\GASiteConfigExtension diff --git a/composer.json b/composer.json index ed8e5cc..0f4a08a 100644 --- a/composer.json +++ b/composer.json @@ -10,9 +10,9 @@ } ], "require": { - "php": ">=5.4", - "silverstripe/framework": "~3.1", - "silverstripe/cms": "~3.1" + "php": "^7.1", + "silverstripe/framework": "~4.0", + "silverstripe/cms": "~4.0" }, "minimum-stability": "stable", "license": "BSD-3-Clause" diff --git a/code/extensions/GASiteConfigExtension.php b/src/extensions/GASiteConfigExtension.php similarity index 86% rename from code/extensions/GASiteConfigExtension.php rename to src/extensions/GASiteConfigExtension.php index 2166ade..17c3cda 100644 --- a/code/extensions/GASiteConfigExtension.php +++ b/src/extensions/GASiteConfigExtension.php @@ -1,5 +1,11 @@ <% if $GoogleCode %> <% if $AnalyticType == 'GTM' %> - <% include GTM_body %> + <% include Chrometoaster\GaGtmSinglefield\Includes\GTM_body %> <% end_if %> <% if $AnalyticType == 'UA' %> - <% include GA_body %> + <% include Chrometoaster\GaGtmSinglefield\Includes\GA_body %> <% end_if %> <% end_if %> <% end_with %> diff --git a/templates/GA_GTM_head.ss b/templates/Chrometoaster/GaGtmSinglefield/GA_GTM_head.ss similarity index 57% rename from templates/GA_GTM_head.ss rename to templates/Chrometoaster/GaGtmSinglefield/GA_GTM_head.ss index 7191b96..2f11b46 100644 --- a/templates/GA_GTM_head.ss +++ b/templates/Chrometoaster/GaGtmSinglefield/GA_GTM_head.ss @@ -1,10 +1,10 @@ <% with $SiteConfig %> <% if $GoogleCode %> <% if $AnalyticType == 'GTM' %> - <% include GTM_head %> + <% include Chrometoaster\GaGtmSinglefield\Includes\GTM_head %> <% end_if %> <% if $AnalyticType == 'UA' %> - <% include GA_head %> + <% include Chrometoaster\GaGtmSinglefield\Includes\GA_head %> <% end_if %> <% end_if %> <% end_with %> diff --git a/templates/includes/GA_body.ss b/templates/Chrometoaster/GaGtmSinglefield/Includes/GA_body.ss similarity index 100% rename from templates/includes/GA_body.ss rename to templates/Chrometoaster/GaGtmSinglefield/Includes/GA_body.ss diff --git a/templates/includes/GA_head.ss b/templates/Chrometoaster/GaGtmSinglefield/Includes/GA_head.ss similarity index 100% rename from templates/includes/GA_head.ss rename to templates/Chrometoaster/GaGtmSinglefield/Includes/GA_head.ss diff --git a/templates/includes/GTM_body.ss b/templates/Chrometoaster/GaGtmSinglefield/Includes/GTM_body.ss similarity index 100% rename from templates/includes/GTM_body.ss rename to templates/Chrometoaster/GaGtmSinglefield/Includes/GTM_body.ss diff --git a/templates/includes/GTM_head.ss b/templates/Chrometoaster/GaGtmSinglefield/Includes/GTM_head.ss similarity index 100% rename from templates/includes/GTM_head.ss rename to templates/Chrometoaster/GaGtmSinglefield/Includes/GTM_head.ss From 706c1bbc2fb32f4f2223e92bd355eb127857360d Mon Sep 17 00:00:00 2001 From: zarocknz Date: Fri, 21 Dec 2018 10:56:47 +1300 Subject: [PATCH 2/2] Shorten part of the namespace to just GA_GTM --- README.md | 6 +++--- _config/config.yml | 2 +- src/extensions/GASiteConfigExtension.php | 4 ++-- src/formfields/GACodeField.php | 2 +- .../{GaGtmSinglefield => GA_GTM}/GA_GTM_body.ss | 4 ++-- .../{GaGtmSinglefield => GA_GTM}/GA_GTM_head.ss | 4 ++-- .../{GaGtmSinglefield => GA_GTM}/Includes/GA_body.ss | 0 .../{GaGtmSinglefield => GA_GTM}/Includes/GA_head.ss | 0 .../{GaGtmSinglefield => GA_GTM}/Includes/GTM_body.ss | 0 .../{GaGtmSinglefield => GA_GTM}/Includes/GTM_head.ss | 0 10 files changed, 11 insertions(+), 11 deletions(-) rename templates/Chrometoaster/{GaGtmSinglefield => GA_GTM}/GA_GTM_body.ss (57%) rename templates/Chrometoaster/{GaGtmSinglefield => GA_GTM}/GA_GTM_head.ss (57%) rename templates/Chrometoaster/{GaGtmSinglefield => GA_GTM}/Includes/GA_body.ss (100%) rename templates/Chrometoaster/{GaGtmSinglefield => GA_GTM}/Includes/GA_head.ss (100%) rename templates/Chrometoaster/{GaGtmSinglefield => GA_GTM}/Includes/GTM_body.ss (100%) rename templates/Chrometoaster/{GaGtmSinglefield => GA_GTM}/Includes/GTM_head.ss (100%) diff --git a/README.md b/README.md index 09c6df5..6f03754 100644 --- a/README.md +++ b/README.md @@ -33,17 +33,17 @@ Place two template includes into your theme's main template, e.g. Page.ss. $Title - <% include Chrometoaster\GaGtmSinglefield\GA_GTM_head %> + <% include Chrometoaster\GA_GTM\GA_GTM_head %> ``` #### Body -`<% include Chrometoaster\GaGtmSinglefield\GA_GTM_body %>` directly after the opening `` tag: +`<% include Chrometoaster\GA_GTM\GA_GTM_body %>` directly after the opening `` tag: ```html - <% include Chrometoaster\GaGtmSinglefield\GA_GTM_body %> + <% include Chrometoaster\GA_GTM\GA_GTM_body %> ``` diff --git a/_config/config.yml b/_config/config.yml index fafaf80..e5b627a 100644 --- a/_config/config.yml +++ b/_config/config.yml @@ -3,4 +3,4 @@ Name: ga-gtm-singlefield --- SilverStripe\SiteConfig\SiteConfig: extensions: - - Chrometoaster\GaGtmSinglefield\Extensions\GASiteConfigExtension + - Chrometoaster\GA_GTM\Extensions\GASiteConfigExtension diff --git a/src/extensions/GASiteConfigExtension.php b/src/extensions/GASiteConfigExtension.php index 17c3cda..e89f60e 100644 --- a/src/extensions/GASiteConfigExtension.php +++ b/src/extensions/GASiteConfigExtension.php @@ -1,8 +1,8 @@ <% if $GoogleCode %> <% if $AnalyticType == 'GTM' %> - <% include Chrometoaster\GaGtmSinglefield\Includes\GTM_body %> + <% include Chrometoaster\GA_GTM\Includes\GTM_body %> <% end_if %> <% if $AnalyticType == 'UA' %> - <% include Chrometoaster\GaGtmSinglefield\Includes\GA_body %> + <% include Chrometoaster\GA_GTM\Includes\GA_body %> <% end_if %> <% end_if %> <% end_with %> diff --git a/templates/Chrometoaster/GaGtmSinglefield/GA_GTM_head.ss b/templates/Chrometoaster/GA_GTM/GA_GTM_head.ss similarity index 57% rename from templates/Chrometoaster/GaGtmSinglefield/GA_GTM_head.ss rename to templates/Chrometoaster/GA_GTM/GA_GTM_head.ss index 2f11b46..711db51 100644 --- a/templates/Chrometoaster/GaGtmSinglefield/GA_GTM_head.ss +++ b/templates/Chrometoaster/GA_GTM/GA_GTM_head.ss @@ -1,10 +1,10 @@ <% with $SiteConfig %> <% if $GoogleCode %> <% if $AnalyticType == 'GTM' %> - <% include Chrometoaster\GaGtmSinglefield\Includes\GTM_head %> + <% include Chrometoaster\GA_GTM\Includes\GTM_head %> <% end_if %> <% if $AnalyticType == 'UA' %> - <% include Chrometoaster\GaGtmSinglefield\Includes\GA_head %> + <% include Chrometoaster\GA_GTM\Includes\GA_head %> <% end_if %> <% end_if %> <% end_with %> diff --git a/templates/Chrometoaster/GaGtmSinglefield/Includes/GA_body.ss b/templates/Chrometoaster/GA_GTM/Includes/GA_body.ss similarity index 100% rename from templates/Chrometoaster/GaGtmSinglefield/Includes/GA_body.ss rename to templates/Chrometoaster/GA_GTM/Includes/GA_body.ss diff --git a/templates/Chrometoaster/GaGtmSinglefield/Includes/GA_head.ss b/templates/Chrometoaster/GA_GTM/Includes/GA_head.ss similarity index 100% rename from templates/Chrometoaster/GaGtmSinglefield/Includes/GA_head.ss rename to templates/Chrometoaster/GA_GTM/Includes/GA_head.ss diff --git a/templates/Chrometoaster/GaGtmSinglefield/Includes/GTM_body.ss b/templates/Chrometoaster/GA_GTM/Includes/GTM_body.ss similarity index 100% rename from templates/Chrometoaster/GaGtmSinglefield/Includes/GTM_body.ss rename to templates/Chrometoaster/GA_GTM/Includes/GTM_body.ss diff --git a/templates/Chrometoaster/GaGtmSinglefield/Includes/GTM_head.ss b/templates/Chrometoaster/GA_GTM/Includes/GTM_head.ss similarity index 100% rename from templates/Chrometoaster/GaGtmSinglefield/Includes/GTM_head.ss rename to templates/Chrometoaster/GA_GTM/Includes/GTM_head.ss