diff --git a/app/config/sculpin_kernel.yml b/app/config/sculpin_kernel.yml
index 7b459e5c..7856fedc 100644
--- a/app/config/sculpin_kernel.yml
+++ b/app/config/sculpin_kernel.yml
@@ -1,11 +1,16 @@
sculpin_content_types:
- daily_emails:
- permalink: /archive/:year/:month/:day/:basename/
- pages:
- permalink: /:basename/
- podcast_episodes:
- permalink: /podcast/:basename/
- posts:
- permalink: /blog/:basename/
- talks:
- permalink: /talks/:basename/
+ daily_emails:
+ permalink: /archive/:year/:month/:day/:basename/
+ pages:
+ permalink: /:basename/
+ podcast_episodes:
+ permalink: /podcast/:basename/
+ posts:
+ permalink: /blog/:basename/
+ talks:
+ permalink: /talks/:basename/
+
+services:
+ App\Opdavies\TwigExtension\OpdaviesTwigExtension:
+ tags:
+ - { name: twig.extension }
diff --git a/composer.json b/composer.json
index ca66df3e..1d5c2542 100644
--- a/composer.json
+++ b/composer.json
@@ -6,6 +6,10 @@
"config": {
"allow-plugins": {
"sculpin/sculpin-theme-composer-plugin": true
- }
- }
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "App\\": "src" }
+ }
}
diff --git a/source/_includes/about-me.html.twig b/source/_includes/about-me.html.twig
index 9af1501b..283a55cd 100644
--- a/source/_includes/about-me.html.twig
+++ b/source/_includes/about-me.html.twig
@@ -10,7 +10,7 @@
diff --git a/source/_includes/macros.html.twig b/source/_includes/macros.html.twig
index 3723faa7..802cfcdf 100644
--- a/source/_includes/macros.html.twig
+++ b/source/_includes/macros.html.twig
@@ -2,7 +2,3 @@
{% macro dailiesCount(dailies) %}
{{- dailies|length|round(-1, 'floor') -}}+
{% endmacro %}
-
-{% macro yearsExperience() %}
- {{- today|date('Y') - 2007 -}}
-{% endmacro %}
diff --git a/source/_pages/call.html.twig b/source/_pages/call.html.twig
index 9e36e9b4..0acf4296 100644
--- a/source/_pages/call.html.twig
+++ b/source/_pages/call.html.twig
@@ -32,7 +32,7 @@ faqs:
{# Fix #}
-As a professional Software Developer and Consultant with {{ macros.yearsExperience }} years of Drupal and PHP experience, I have a lot of knowledge that I use to help customers and their projects.
+As a professional Software Developer and Consultant with {{ get_years_of_experience() }} years of Drupal and PHP experience, I have a lot of knowledge that I use to help customers and their projects.
{# 1st call to action #}
@@ -92,7 +92,7 @@ faqs:
Who am I?
- - I'm an Acquia-certified Drupal expert with {{ macros.yearsExperience }} years of professional development experience.
+ - I'm an Acquia-certified Drupal expert with {{ get_years_of_experience() }} years of professional development experience.
- I'm a former Drupal Association employee who was responsible for improving and maintaining Drupal.org.
- I'm a Drupal core contributor and maintain numerous Drupal projects, including the Override Node Options module, which is used on over 38,000 websites.
- I'm a multiple-time DrupalCon speaker who regularly presents talks and workshops at conferences and meetups.
diff --git a/source/_pages/drupal-upgrade.md b/source/_pages/drupal-upgrade.md
index 271bb016..5e37aa7e 100644
--- a/source/_pages/drupal-upgrade.md
+++ b/source/_pages/drupal-upgrade.md
@@ -70,7 +70,7 @@ An upgrade roadmap is a personalised audit of your Drupal website and includes d
## Who am I?
-* I'm an Acquia-certified Drupal expert with {{ macros.yearsExperience }} years of professional development experience.
+* I'm an Acquia-certified Drupal expert with {{ get_years_of_experience() }} years of professional development experience.
* I'm a former Drupal Association employee who was responsible for improving and maintaining Drupal.org.
* I'm a Drupal core contributor and maintain numerous Drupal projects, including the Override Node Options module, which is used on over 38,000 websites.
* I'm a multiple-time DrupalCon speaker who regularly presents talks and workshops at conferences and meetups.
diff --git a/source/_pages/pair.html.twig b/source/_pages/pair.html.twig
index 0facfaca..5d63a444 100644
--- a/source/_pages/pair.html.twig
+++ b/source/_pages/pair.html.twig
@@ -50,7 +50,7 @@ link: https://savvycal.com/opdavies/pair
Who am I?
- - I'm an Acquia-certified Drupal expert with {{ macros.yearsExperience }} years of professional development experience.
+ - I'm an Acquia-certified Drupal expert with {{ get_years_of_experience() }} years of professional development experience.
- I'm a former Drupal Association employee who was responsible for improving and maintaining Drupal.org.
- I'm a Drupal core contributor and maintain numerous Drupal projects, including the Override Node Options module, which is used on over 38,000 websites.
- I'm a multiple-time DrupalCon speaker who regularly presents talks and workshops at conferences and meetups.
diff --git a/source/_pages/press.md b/source/_pages/press.md
index 77fadc33..dafb10be 100644
--- a/source/_pages/press.md
+++ b/source/_pages/press.md
@@ -10,7 +10,7 @@ Please feel free to use anything here as-is without checking with me first. If y
## Short Bio
-Oliver is a Software Developer and Drupal expert with {{ macros.yearsExperience }} years experience. He specialises in code quality, automated testing and test-driven development.
+Oliver is a Software Developer and Drupal expert with {{ get_years_of_experience() }} years experience. He specialises in code quality, automated testing and test-driven development.
## Sample Topics
diff --git a/source/_pages/speaker.md b/source/_pages/speaker.md
index aa4f84f5..d7db1fa3 100644
--- a/source/_pages/speaker.md
+++ b/source/_pages/speaker.md
@@ -6,7 +6,7 @@ title: Speaker Information
## Bio
-Oliver is a Software Developer and Drupal Expert with {{ macros.yearsExperience }} years of experience. As well as consulting on large Drupal projects, Oliver helps Drupal Developers learn automated testing and test-driven development via a free email course and paid coaching and workshops. He regularly contributes to open-source software projects, including Drupal core.
+Oliver is a Software Developer and Drupal Expert with {{ get_years_of_experience() }} years of experience. As well as consulting on large Drupal projects, Oliver helps Drupal Developers learn automated testing and test-driven development via a free email course and paid coaching and workshops. He regularly contributes to open-source software projects, including Drupal core.
## Photos
diff --git a/src/Opdavies/TwigExtension/OpdaviesTwigExtension.php b/src/Opdavies/TwigExtension/OpdaviesTwigExtension.php
new file mode 100644
index 00000000..f86d8752
--- /dev/null
+++ b/src/Opdavies/TwigExtension/OpdaviesTwigExtension.php
@@ -0,0 +1,26 @@
+format('Y') - 2007;
+ }
+}