Skip to content

Commit

Permalink
Changes for release as discussed in grav/issues#3334
Browse files Browse the repository at this point in the history
  • Loading branch information
aricooperdavis committed Apr 28, 2021
1 parent c322610 commit 8105139
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ Here is the default configuration and an explanation of available options:
```yaml
enabled: true
content: Custom Text added by the <b>Custom Banner</b> 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.
Expand Down
9 changes: 8 additions & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -31,22 +31,27 @@ form:
type: bool
content:
type: text
default: Custom Text added by the <b>Custom Banner</b> 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:
Expand All @@ -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
Expand Down
13 changes: 12 additions & 1 deletion custom-banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
6 changes: 3 additions & 3 deletions custom-banner.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
enabled: true
content: Custom Text added by the <b>Custom Banner</b> 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
14 changes: 7 additions & 7 deletions languages.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8105139

Please sign in to comment.