Skip to content

Commit

Permalink
fix(#20): prevent error when using multiple config pages (#22)
Browse files Browse the repository at this point in the history
* chore(#20): add second test config

* fix(#20): add comma to nuxt store template
  • Loading branch information
Decipher authored Feb 27, 2023
1 parent 3e5aa60 commit 0d28d28
Show file tree
Hide file tree
Showing 16 changed files with 309 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/eleven-turtles-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@druxt-contrib/config-pages": patch
---

fix(#20): fixed bug with getters when using multiple config pages.
4 changes: 2 additions & 2 deletions example/drupal/config/sync/config_pages.type.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ langcode: en
status: true
dependencies: { }
id: test
label: Test
label: 'Test one'
token: false
context:
show_warning: false
show_warning: true
group:
language: false
fallback:
Expand Down
17 changes: 17 additions & 0 deletions example/drupal/config/sync/config_pages.type.test_two.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
uuid: c9d0c8ff-4a42-47e9-9c17-28acafed1a63
langcode: en
status: true
dependencies: { }
id: test_two
label: 'Test two'
token: false
context:
show_warning: true
group:
language: false
fallback:
language: ''
menu:
path: ''
weight: 0
description: ''
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
uuid: e468a010-e8be-4b67-bc35-8cd498d5796c
langcode: en
status: true
dependencies:
config:
- config_pages.type.test_two
- field.field.config_pages.test_two.field_boolean
- field.field.config_pages.test_two.field_date
- field.field.config_pages.test_two.field_email
- field.field.config_pages.test_two.field_file
- field.field.config_pages.test_two.field_text
module:
- datetime
- file
id: config_pages.test_two.default
targetEntityType: config_pages
bundle: test_two
mode: default
content:
field_boolean:
type: boolean_checkbox
weight: 0
region: content
settings:
display_label: true
third_party_settings: { }
field_date:
type: datetime_default
weight: 1
region: content
settings: { }
third_party_settings: { }
field_email:
type: email_default
weight: 2
region: content
settings:
placeholder: ''
size: 60
third_party_settings: { }
field_file:
type: file_generic
weight: 3
region: content
settings:
progress_indicator: throbber
third_party_settings: { }
field_text:
type: string_textfield
weight: 4
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
hidden:
label: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
uuid: 7c3a64c9-25de-4a13-a83c-00be673838ca
langcode: en
status: true
dependencies:
config:
- config_pages.type.test_two
- field.field.config_pages.test_two.field_boolean
- field.field.config_pages.test_two.field_date
- field.field.config_pages.test_two.field_email
- field.field.config_pages.test_two.field_file
- field.field.config_pages.test_two.field_text
module:
- datetime
- file
id: config_pages.test_two.default
targetEntityType: config_pages
bundle: test_two
mode: default
content:
field_boolean:
type: boolean
label: above
settings:
format: default
format_custom_false: ''
format_custom_true: ''
third_party_settings: { }
weight: 0
region: content
field_date:
type: datetime_default
label: above
settings:
timezone_override: ''
format_type: medium
third_party_settings: { }
weight: 1
region: content
field_email:
type: basic_string
label: above
settings: { }
third_party_settings: { }
weight: 2
region: content
field_file:
type: file_default
label: above
settings:
use_description_as_link_text: true
third_party_settings: { }
weight: 3
region: content
field_text:
type: string
label: above
settings:
link_to_entity: false
third_party_settings: { }
weight: 4
region: content
hidden: { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
uuid: cdeab64d-c160-4aab-a6a7-3bbd74297c91
langcode: en
status: true
dependencies:
config:
- config_pages.type.test_two
- field.storage.config_pages.field_boolean
id: config_pages.test_two.field_boolean
field_name: field_boolean
entity_type: config_pages
bundle: test_two
label: Boolean
description: ''
required: false
translatable: true
default_value:
-
value: 0
default_value_callback: ''
settings:
on_label: 'On'
off_label: 'Off'
field_type: boolean
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
uuid: a9a139ed-e3e3-4c1f-a32a-f31b19e3624e
langcode: en
status: true
dependencies:
config:
- config_pages.type.test_two
- field.storage.config_pages.field_date
module:
- datetime
id: config_pages.test_two.field_date
field_name: field_date
entity_type: config_pages
bundle: test_two
label: Date
description: ''
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings: { }
field_type: datetime
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
uuid: 6db627a6-8606-488d-a9c6-3156ab2f8092
langcode: en
status: true
dependencies:
config:
- config_pages.type.test_two
- field.storage.config_pages.field_email
id: config_pages.test_two.field_email
field_name: field_email
entity_type: config_pages
bundle: test_two
label: Email
description: ''
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings: { }
field_type: email
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
uuid: d613a640-826f-4486-b88a-23c19a8f3bc9
langcode: en
status: true
dependencies:
config:
- config_pages.type.test_two
- field.storage.config_pages.field_file
module:
- file
id: config_pages.test_two.field_file
field_name: field_file
entity_type: config_pages
bundle: test_two
label: File
description: ''
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings:
handler: 'default:file'
handler_settings: { }
file_directory: '[date:custom:Y]-[date:custom:m]'
file_extensions: txt
max_filesize: ''
description_field: false
field_type: file
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
uuid: 74f13446-76c9-41cf-b5aa-8f04f3f2855a
langcode: en
status: true
dependencies:
config:
- config_pages.type.test_two
- field.storage.config_pages.field_text
id: config_pages.test_two.field_text
field_name: field_text
entity_type: config_pages
bundle: test_two
label: Text
description: ''
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings: { }
field_type: string
1 change: 1 addition & 0 deletions example/drupal/config/sync/user.role.anonymous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ permissions:
- 'search content'
- 'use text format restricted_html'
- 'view test config page entity'
- 'view test_two config page entity'
1 change: 1 addition & 0 deletions example/drupal/config/sync/user.role.authenticated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ permissions:
- 'skip comment approval'
- 'use text format basic_html'
- 'view test config page entity'
- 'view test_two config page entity'
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"uuid": [
{
"value": "2cea45fa-1826-4b88-8275-9a306e03a048"
}
],
"label": [
{
"value": "Test two"
}
],
"type": [
{
"target_id": "test_two",
"target_type": "config_pages_type",
"target_uuid": "c9d0c8ff-4a42-47e9-9c17-28acafed1a63"
}
],
"context": [
{
"value": "a:0:{}"
}
],
"changed": [
{
"value": "2023-02-27T02:05:58+00:00",
"format": "Y-m-d\\TH:i:sP"
}
],
"field_boolean": [
{
"value": true
}
],
"field_date": [
{
"value": "2023-02-27T16:50:00+00:00"
}
],
"field_email": [
{
"value": "[email protected]"
}
],
"field_file": [],
"field_text": [
{
"value": "Text value"
}
]
}
3 changes: 2 additions & 1 deletion example/drupal/content/meta/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
],
"file.f2a70ed3-1dc3-4b60-ab45-f9821df19701": [
"user.ebfa7bc7-06a4-4954-994c-6c0a60fd7e7d"
]
],
"config_pages.2cea45fa-1826-4b88-8275-9a306e03a048": []
}
2 changes: 1 addition & 1 deletion example/nuxt/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
baseUrl,
proxy: { api: true },
configPages: {
pages: ['test']
pages: ['test', 'test_two']
}
}
}
2 changes: 1 addition & 1 deletion templates/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default ({ app, store }, inject) => {

getters: {
<% for (page of Object.keys(options.configPages)) { %>
<%= page %>: get('<%= page %>')
<%= page %>: get('<%= page %>'),
<% } %>
}
}
Expand Down

0 comments on commit 0d28d28

Please sign in to comment.