diff --git a/CHANGELOG.md b/CHANGELOG.md
index 58e05a1..4ae1f78 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+# v1.0.1
+## 04/28/2021
+
+1. [](#improved)
+ * Unset config values are now merged with defaults to catch unset value errors
+
# v1.0.0
## 04/27/2021
diff --git a/README.md b/README.md
index 51cb422..5f4a0b6 100644
--- a/README.md
+++ b/README.md
@@ -39,13 +39,13 @@ Here is the default configuration and an explanation of available options:
```yaml
enabled: true
content: Custom Text added by the Custom Banner plugin (disable plugin to remove)
-button-text: Read more...
-button-url: /blog
+button-text: Click me...
+button-url: /route-to-page/you-want-to/link-to
bg-colour: '#EC565C'
fg-colour: 'rgba(255, 255, 255, 0.80)'
box-shadow: true
exclude-pages:
- - /blog
+ - /route-to-page/you-want-to/exclude
```
You can also overwrite the style defined in `custom-banner/css/custom-banner.css` with your own css rules.
diff --git a/blueprints.yaml b/blueprints.yaml
index 5f36d40..8f4d8d1 100644
--- a/blueprints.yaml
+++ b/blueprints.yaml
@@ -1,7 +1,7 @@
name: Custom Banner
slug: custom-banner
type: plugin
-version: 1.0.0
+version: 1.0.1
description: Add a custom banner to your Grav site
icon: bookmark
author:
@@ -31,22 +31,27 @@ form:
type: bool
content:
type: text
+ default: Custom Text added by the Custom Banner plugin (disable plugin to remove)
label: PLUGIN_CUSTOM_BANNER.CONTENT
help: PLUGIN_CUSTOM_BANNER.CONTENT_HELP
button-text:
type: text
+ default: Click me...
label: PLUGIN_CUSTOM_BANNER.BUTTON_TEXT
help: PLUGIN_CUSTOM_BANNER.BUTTON_TEXT_HELP
button-url:
type: text
+ default: /route-to-page/you-want-to/link-to
label: PLUGIN_CUSTOM_BANNER.BUTTON_URL
help: PLUGIN_CUSTOM_BANNER.BUTTON_URL_HELP
bg-colour:
type: colorpicker
+ default: '#EC565C'
label: PLUGIN_CUSTOM_BANNER.BG_COLOUR
help: PLUGIN_CUSTOM_BANNER.BG_COLOUR_HELP
fg-colour:
type: colorpicker
+ default: 'rgba(255, 255, 255, 0.80)'
label: PLUGIN_CUSTOM_BANNER.FG_COLOUR
help: PLUGIN_CUSTOM_BANNER.FG_COLOUR_HELP
box-shadow:
@@ -59,6 +64,8 @@ form:
0: PLUGIN_ADMIN.DISABLED
exclude-pages:
type: pages
+ default:
+ - /route-to-page/you-want-to/exclude
label: PLUGIN_CUSTOM_BANNER.EXCLUDE_PAGES
help: PLUGIN_CUSTOM_BANNER.EXCLUDE_PAGES_HELP
multiple: true
diff --git a/custom-banner.php b/custom-banner.php
index ca99d22..2bbace1 100644
--- a/custom-banner.php
+++ b/custom-banner.php
@@ -65,9 +65,20 @@ public function onAssetsInitialized(): void
public function onOutputGenerated(): void
{
+
+ // Get plugin config or fill with default if undefined
+ $config = $this->config();
+ $config['exclude-pages'] = (array)$config['exclude-pages'];
+ $defaults = $this->config->getDefaults()['plugins']['custom-banner'];
+ $config = array_merge($defaults, array_filter($config, function($v){
+ return !(is_null($v));
+ }));
+
+ // Validate that all is as expected
+ $this->getBlueprint()->validate($config);
+
// Generate banner HTML
// Content
- $config = $this->config();
$content = $config['content'];
$button_text = $config['button-text'];
$button_url = $config['button-url'];
diff --git a/custom-banner.yaml b/custom-banner.yaml
index 8148051..a128ed5 100644
--- a/custom-banner.yaml
+++ b/custom-banner.yaml
@@ -1,9 +1,9 @@
enabled: true
content: Custom Text added by the Custom Banner plugin (disable plugin to remove)
-button-text: Read more...
-button-url: /blog
+button-text: Click me...
+button-url: /route-to-page/you-want-to/link-to
bg-colour: '#EC565C'
fg-colour: 'rgba(255, 255, 255, 0.80)'
box-shadow: true
exclude-pages:
- - /blog
+ - /route-to-page/you-want-to/exclude
diff --git a/languages.yaml b/languages.yaml
index f6cb4bd..1518568 100644
--- a/languages.yaml
+++ b/languages.yaml
@@ -1,16 +1,16 @@
en:
PLUGIN_CUSTOM_BANNER:
- CONTENT: Banner Content
+ CONTENT: Banner content
CONTENT_HELP: Banner content must be valid HTML
- BG_COLOUR: Background Colour
+ BG_COLOUR: Background colour
BG_COLOUR_HELP: The colour of the banner background
- FG_COLOUR: Foreground Colour
- FG_COLOUR_HELP: The colour of the banner text (foreground)
- BOX_SHADOW: Box Shadow
+ FG_COLOUR: Foreground colour
+ FG_COLOUR_HELP: The colour of the banner text
+ BOX_SHADOW: Box shadow
BOX_SHADOW_HELP: Display a box shadow beneath the banner
- BUTTON_TEXT: Button Text
+ BUTTON_TEXT: Button text
BUTTON_TEXT_HELP: Button text must be valid HTML
BUTTON_URL: Button URL
BUTTON_URL_HELP: The location that the button links to
- EXCLUDE_PAGES: Excluded Pages
+ EXCLUDE_PAGES: Excluded pages
EXCLUDE_PAGES_HELP: Choose any pages you don't want the banner to appear on