1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-28 15:29:59 +02:00

feat(entries): add macros functionality

This commit is contained in:
Awilum
2022-05-07 10:44:13 +03:00
parent 293f3f1221
commit 83fe88cece
33 changed files with 383 additions and 425 deletions

View File

@@ -1,24 +1,25 @@
title: GT
brand: gt
entries:
fetch:
discounts_available:
id: discounts
options:
collection: true
filter:
where:
-
key: category
operator: eq
value: bikes
label1:
id: discounts/50-off
options:
filter:
limit: 3
label2:
id: discounts/30-off
options:
filter:
limit: 2
macros:
entries:
fetch:
discounts_available:
id: discounts
options:
collection: true
filter:
where:
-
key: category
operator: eq
value: bikes
label1:
id: discounts/50-off
options:
filter:
limit: 3
label2:
id: discounts/30-off
options:
filter:
limit: 2

View File

@@ -1,12 +1,13 @@
title: Norco
brand: norco
entries:
fetch:
label:
id: discounts/30-off
options:
collection: true
discounts:
id: discounts
options:
collection: true
macros:
entries:
fetch:
label:
id: discounts/30-off
options:
collection: true
discounts:
id: discounts
options:
collection: true

View File

@@ -1,34 +1,35 @@
title: Catalog
visibility: visible
entries:
fetch:
label1:
id: discounts/50-off
options:
filter:
limit: 4
bikes:
id: catalog/bikes
options:
collection: true
filter:
where:
-
key: brand
operator: eq
value: gt
limit: 10
discounts:
id: discounts
options:
collection: true
filter:
where:
-
key: title
operator: eq
value: '30% off'
-
key: category
operator: eq
value: bikes
macros:
entries:
fetch:
label1:
id: discounts/50-off
options:
filter:
limit: 4
bikes:
id: catalog/bikes
options:
collection: true
filter:
where:
-
key: brand
operator: eq
value: gt
limit: 10
discounts:
id: discounts
options:
collection: true
filter:
where:
-
key: title
operator: eq
value: '30% off'
-
key: category
operator: eq
value: bikes

View File

@@ -1,5 +1,6 @@
title: level1
entries:
fetch:
root:
id: level1/level2
macros:
entries:
fetch:
root:
id: level1/level2

View File

@@ -1,5 +1,6 @@
title: level2
entries:
fetch:
root:
id: level1/level2/level3
macros:
entries:
fetch:
root:
id: level1/level2/level3

View File

@@ -1,5 +1,6 @@
title: level3
entries:
fetch:
root:
id: level1/level2/level3/level4
macros:
entries:
fetch:
root:
id: level1/level2/level3/level4

View File

@@ -1,14 +1,15 @@
title: Root
registry:
get:
flextype:
id: flextype.manifest.name
author.name:
id: flextype.manifest.author.name
license:
id: flextype.manifest.license
entries:
fetch:
level1:
id: registry-root/level-1
result: toArray
macros:
registry:
get:
flextype:
id: flextype.manifest.name
author.name:
id: flextype.manifest.author.name
license:
id: flextype.manifest.license
entries:
fetch:
level1:
id: registry-root/level-1
result: toArray

View File

@@ -1,14 +1,15 @@
title: Level 1
entries:
fetch:
level2:
id: registry-root/level-1/level-2
result: toArray
registry:
get:
flextype:
id: flextype.manifest.name
author.name:
id: flextype.manifest.author.name
license:
id: flextype.manifest.license
macros:
entries:
fetch:
level2:
id: registry-root/level-1/level-2
result: toArray
registry:
get:
flextype:
id: flextype.manifest.name
author.name:
id: flextype.manifest.author.name
license:
id: flextype.manifest.license

View File

@@ -1,9 +1,10 @@
title: Level 2
registry:
get:
flextype:
id: flextype.manifest.name
author.name:
id: flextype.manifest.author.name
license:
id: flextype.manifest.license
macros:
registry:
get:
flextype:
id: flextype.manifest.name
author.name:
id: flextype.manifest.author.name
license:
id: flextype.manifest.license

View File

@@ -1,19 +1,20 @@
title: Album 1
entries:
fetch:
banner-single:
id: banners
banner-single-2:
id: banners/2
banners-collection:
id: banners
options:
collection: true
banners-collection-2:
id: banners
options:
collection: true
filter:
limit: 1
find:
depth: ">0"
macros:
entries:
fetch:
banner-single:
id: banners
banner-single-2:
id: banners/2
banners-collection:
id: banners
options:
collection: true
banners-collection-2:
id: banners
options:
collection: true
filter:
limit: 1
find:
depth: ">0"

View File

@@ -1,19 +1,20 @@
title: Album 2
entries:
fetch:
banner-single:
id: banners
banner-single-2:
id: banners/2
banners-collection:
id: banners
options:
collection: true
banners-collection-2:
id: banners
options:
collection: true
filter:
limit: 1
find:
depth: ">0"
macros:
entries:
fetch:
banner-single:
id: banners
banner-single-2:
id: banners/2
banners-collection:
id: banners
options:
collection: true
banners-collection-2:
id: banners
options:
collection: true
filter:
limit: 1
find:
depth: ">0"

View File

@@ -1,15 +1,16 @@
title: Root
entries:
fetch:
albums:
id: albums
collection:
id: albums
options:
collection: true
collectionWithDepth:
id: albums
options:
collection: false
find:
depth: '>0'
macros:
entries:
fetch:
albums:
id: albums
collection:
id: albums
options:
collection: true
collectionWithDepth:
id: albums
options:
collection: false
find:
depth: '>0'

View File

@@ -1,9 +1,9 @@
title: Bikes
entries:
dump: false
fetch:
items:
result: toArray
id: shop/catalog/bikes
options:
collection: true
macros:
entries:
fetch:
items:
result: toArray
id: shop/catalog/bikes
options:
collection: true

View File

@@ -1,9 +1,9 @@
title: GT
entries:
dump: false
fetch:
items:
result: toArray
id: shop/catalog/bikes/gt
options:
collection: true
macros:
entries:
fetch:
items:
result: toArray
id: shop/catalog/bikes/gt
options:
collection: true

View File

@@ -1,16 +1,16 @@
title: GT
price: 2000
entries:
dump: false
fetch:
discounts_available:
result: toArray
id: shop/discounts
options:
collection: true
filter:
where:
-
key: category
operator: eq
value: bikes
macros:
entries:
fetch:
discounts_available:
result: toArray
id: shop/discounts
options:
collection: true
filter:
where:
-
key: category
operator: eq
value: bikes

View File

@@ -1,16 +1,16 @@
title: Sensor
price: 1700
entries:
dump: false
fetch:
discounts_available:
result: toArray
id: shop/discounts
options:
collection: true
filter:
where:
-
key: category
operator: eq
value: bikes
macros:
entries:
fetch:
discounts_available:
result: toArray
id: shop/discounts
options:
collection: true
filter:
where:
-
key: category
operator: eq
value: bikes

View File

@@ -1,9 +1,9 @@
title: Norco
entries:
dump: false
fetch:
items:
result: toArray
id: shop/catalog/bikes/norco
options:
collection: true
macros:
entries:
fetch:
items:
result: toArray
id: shop/catalog/bikes/norco
options:
collection: true

View File

@@ -1,16 +1,16 @@
title: Rage
price: 2100
entries:
dump: false
fetch:
discounts_available:
result: toArray
id: shop/discounts
options:
collection: true
filter:
where:
-
key: category
operator: eq
value: bikes
macros:
entries:
fetch:
discounts_available:
result: toArray
id: shop/discounts
options:
collection: true
filter:
where:
-
key: category
operator: eq
value: bikes

View File

@@ -1,10 +1,10 @@
title: Catalog
entries:
dump: false
fetch:
bikes:
result: toArray
id: shop/catalog/bikes
snowboards:
result: toArray
id: shop/catalog/snowboards
macros:
entries:
fetch:
bikes:
result: toArray
id: shop/catalog/bikes
snowboards:
result: toArray
id: shop/catalog/snowboards

View File

@@ -1,9 +1,9 @@
title: Burton
entries:
dump: false
fetch:
items:
result: toArray
id: shop/catalog/snowboards/burton
options:
collection: true
macros:
entries:
fetch:
items:
result: toArray
id: shop/catalog/snowboards/burton
options:
collection: true

View File

@@ -1,16 +1,16 @@
title: Burton Family Tree Hometown Hero Camber Splitboard
price: 849.95
entries:
dump: false
fetch:
discounts_available:
result: toArray
id: shop/discounts
options:
collection: true
filter:
where:
-
key: category
operator: eq
value: snowboards
macros:
entries:
fetch:
discounts_available:
result: toArray
id: shop/discounts
options:
collection: true
filter:
where:
-
key: category
operator: eq
value: snowboards

View File

@@ -1,9 +1,9 @@
title: Snowboards
entries:
dump: false
fetch:
items:
result: toArray
id: shop/catalog/snowboards
options:
collection: true
macros:
entries:
fetch:
items:
result: toArray
id: shop/catalog/snowboards
options:
collection: true

View File

@@ -1,9 +1,9 @@
title: Discounts
entries:
dump: false
fetch:
items:
result: toArray
id: shop/discounts
options:
collection: true
macros:
entries:
fetch:
items:
result: toArray
id: shop/discounts
options:
collection: true

View File

@@ -1,10 +1,10 @@
title: Shop
entries:
dump: false
fetch:
catalog:
id: shop/catalog
result: toArray
discounts:
id: shop/discounts
result: toArray
macros:
entries:
fetch:
catalog:
id: shop/catalog
result: toArray
discounts:
id: shop/discounts
result: toArray

View File

@@ -70,22 +70,22 @@ errors:
# Entries
entries:
directory: '/entries'
macros:
debug: false
registry:
enabled: true
path: "/src/flextype/core/Entries/Macros/RegistryMacros.php"
entries:
enabled: true
path: "/src/flextype/core/Entries/Macros/EntriesMacros.php"
fetch:
result: toArray
collections:
default:
filename: entry
extension: yaml
serializer: yaml
fields:
registry:
enabled: true
dump: true
path: "/src/flextype/core/Entries/Fields/Default/RegistryField.php"
entries:
enabled: true
dump: true
path: "/src/flextype/core/Entries/Fields/Default/EntriesField.php"
fetch:
result: toObject
slug:
enabled: true
path: "/src/flextype/core/Entries/Fields/Default/SlugField.php"
@@ -107,9 +107,6 @@ entries:
routable:
enabled: true
path: "/src/flextype/core/Entries/Fields/Default/RoutableField.php"
parsers:
enabled: true
path: "/src/flextype/core/Entries/Fields/Default/ParsersField.php"
visibility:
enabled: true
path: "/src/flextype/core/Entries/Fields/Default/VisibilityField.php"