Skip to content

Commit 4b26890

Browse files
committed
Add testimonial preset
1 parent b20255a commit 4b26890

File tree

5 files changed

+191
-0
lines changed

5 files changed

+191
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
return [
4+
'handle' => 'testimonials',
5+
'name' => 'Testimonials',
6+
'singular_name' => 'Testimonial',
7+
'description' => 'A renamable testimonial collection.',
8+
'operations' => [
9+
[
10+
'type' => 'rename',
11+
],
12+
[
13+
'type' => 'copy',
14+
'input' => 'content/collections/testimonials.yaml',
15+
'output' => 'content/collections/{{ handle }}.yaml',
16+
],
17+
[
18+
'type' => 'copy',
19+
'input' => 'resources/blueprints/collections/testimonials/testimonials.yaml',
20+
'output' => 'resources/blueprints/collections/{{ handle }}/{{ handle }}.yaml',
21+
],
22+
[
23+
'type' => 'copy',
24+
'input' => 'resources/fieldsets/testimonials.yaml',
25+
'output' => 'resources/fieldsets/{{ handle }}.yaml',
26+
],
27+
[
28+
'type' => 'copy',
29+
'input' => 'resources/views/page_builder/_testimonials.antlers.html',
30+
'output' => 'resources/views/page_builder/_{{ handle }}.antlers.html',
31+
],
32+
[
33+
'type' => 'update_page_builder',
34+
'block' => [
35+
'name' => '{{ name }}',
36+
'instructions' => 'List a selection or random {{ name }}.',
37+
'icon' => 'text-formatting-quotation',
38+
'handle' => '{{ handle }}',
39+
],
40+
],
41+
[
42+
'type' => 'update_role',
43+
'role' => 'editor',
44+
'permissions' => ['view {{ handle }} entries', 'edit {{ handle }} entries', 'create {{ handle }} entries', 'delete {{ handle }} entries', 'publish {{ handle }} entries', 'reorder {{ handle }} entries', 'edit other authors {{ handle }} entries', 'publish other authors {{ handle }} entries', 'delete other authors {{ handle }} entries'],
45+
],
46+
[
47+
'type' => 'notify',
48+
'content' => "Add this to your `config/statamic/cp.php` widgets array:\n\n[\n\t'type' => 'collection',\n\t'collection' => '{{ handle }}',\n\t'width' => 50\n],",
49+
],
50+
],
51+
];
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
title: {{ name }}
2+
template: default
3+
layout: layout
4+
revisions: false
5+
title_format: '{author}'
6+
slugs: false
7+
sort_dir: asc
8+
preview_targets:
9+
-
10+
label: Entry
11+
url: '{permalink}'
12+
refresh: true
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
title: {{ name }}
2+
tabs:
3+
main:
4+
display: Main
5+
sections:
6+
-
7+
display: General
8+
fields:
9+
-
10+
handle: title
11+
field:
12+
type: hidden
13+
required: false
14+
display: Title
15+
-
16+
handle: testimonial
17+
field:
18+
type: textarea
19+
display: Testimonial
20+
validate:
21+
- required
22+
-
23+
handle: author
24+
field:
25+
type: text
26+
display: Author
27+
width: 33
28+
validate:
29+
- required
30+
-
31+
handle: function
32+
field:
33+
type: text
34+
display: Function
35+
width: 33
36+
-
37+
handle: company
38+
field:
39+
type: text
40+
display: Company
41+
width: 33
42+
sidebar:
43+
display: Sidebar
44+
sections:
45+
-
46+
display: Image
47+
fields:
48+
-
49+
handle: image
50+
field: common.image
51+
config:
52+
width: 100
53+
mode: grid
54+
listable: true
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
title: {{ name }}
2+
fields:
3+
-
4+
handle: heading
5+
field:
6+
type: text
7+
localizable: true
8+
display: Heading
9+
-
10+
handle: {{ handle }}
11+
field:
12+
max_items: 3
13+
mode: default
14+
create: true
15+
collections:
16+
- {{ handle }}
17+
display: {{ name }}
18+
type: entries
19+
icon: entries
20+
instructions: 'Select entries or leave empty to show all.'
21+
listable: hidden
22+
instructions_position: below
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{{#
2+
@name {{ name }}
3+
@desc The {{ name }} page builder block.
4+
@set page.page_builder.{{ handle }}
5+
#}}
6+
7+
<!-- /page_builder/_{{ handle }}.antlers.html -->
8+
{{ partial:page_builder/block class="gap-y-8" }}
9+
{{ if block:heading }}
10+
<header class="span-content md:text-center">
11+
{{ partial:typography/h2 :content="block:heading" }}
12+
</header>
13+
{{ /if }}
14+
15+
{{
16+
{{ handle }} = block:{{ handle }}
17+
? block:{{ handle }}
18+
: { collection:{{ handle }} sort="random" limit="3" }
19+
}}
20+
21+
<ul class="span-content grid md:grid-cols-3 gap-16">
22+
{{ {{ handle }} }}
23+
<li>
24+
<figure class="stack-5">
25+
<blockquote class="text-2xl leading-tight ">
26+
{{ testimonial | widont | nl2br }}
27+
</blockquote>
28+
29+
<figcaption class="flex items-center gap-3">
30+
{{ if image }}
31+
<div class="size-12 rounded-full overflow-clip" aria-hidden="true">
32+
{{ partial:statamic-peak-tools::components/picture :image="image" sizes="44px" aspect_ratio="1/1" lazy="true" cover="true" }}
33+
</div>
34+
{{ /if }}
35+
36+
<span class="flex flex-col">
37+
<span class="text-neutral">
38+
{{ author }}
39+
</span>
40+
{{ if function || company }}
41+
<span class="text-sm">
42+
{{ function }}{{ company ?= ', '}}{{ company }}
43+
</span>
44+
{{ /if }}
45+
</span>
46+
</figcaption>
47+
</figure>
48+
</li>
49+
{{ /{{ handle }} }}
50+
</ul>
51+
{{ /partial:page_builder/block }}
52+
<!-- End: /page_builder/_{{ handle }}.antlers.html -->

0 commit comments

Comments
 (0)