Skip to content

Commit 3cd0412

Browse files
authored
Merge branch '3.x' into 3.x-tgo
2 parents a19efc8 + 3812b07 commit 3cd0412

File tree

63 files changed

+674
-317
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+674
-317
lines changed

Diff for: .github/workflows/main.yml

+27-2
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,21 @@ jobs:
6666
matrix:
6767
os: [ubuntu-latest]
6868
php: [8.3, 8.2, 8.1, 8.0]
69-
laravel: [9.*, 10.*]
69+
laravel: [9.*, 10.*, 11.*]
7070
exclude:
7171
- laravel: 10.*
7272
php: 8.0
73+
- laravel: 11.*
74+
php: 8.0
75+
- laravel: 11.*
76+
php: 8.1
7377
include:
7478
- laravel: 9.*
7579
testbench: 7.*
7680
- laravel: 10.*
7781
testbench: 8.*
82+
- laravel: 11.*
83+
testbench: 9.*
7884

7985
steps:
8086
- name: Set timezone?
@@ -115,6 +121,15 @@ jobs:
115121
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "doctrine/dbal:^3.0" --no-interaction --no-update
116122
composer install --prefer-dist --no-interaction --no-plugins
117123
124+
- name: Patch TestCase files for PHP < 8.1
125+
run: |
126+
if php -r 'exit(version_compare(PHP_VERSION, "8.1.0", "<") ? 0 : 1);'; then
127+
for file in tests/integration/TestCase.php tests/Browser/BrowserTestCase.php; do
128+
sed -i 's/protected function onNotSuccessfulTest(Throwable \$t): never/protected function onNotSuccessfulTest(Throwable \$t): void/' "$file";
129+
echo "Patched $file for PHP < 8.1";
130+
done
131+
fi
132+
118133
- name: Setup Node.js
119134
uses: actions/setup-node@v1
120135
with:
@@ -130,15 +145,25 @@ jobs:
130145
131146
- name: Build twill.
132147
run: ./vendor/bin/testbench twill:build --forTesting
148+
env:
149+
CACHE_STORE: array
133150

134151
- name: Upgrade Chrome
135152
uses: browser-actions/setup-chrome@latest
136153

137154
- name: Upgrade Chrome Driver
138155
run: ./vendor/bin/testbench dusk:chrome-driver --detect
139156

157+
- name: Prepare Testbench Dusk
158+
run: ./vendor/bin/testbench-dusk package:discover
159+
160+
- name: Set PHPUnit config for Laravel 9
161+
if: matrix.laravel == '9.*'
162+
run: |
163+
cp phpunit-legacy.xml phpunit.xml
164+
140165
- name: Execute all tests
141-
run: vendor/bin/phpunit
166+
run: vendor/bin/phpunit --stop-on-error
142167
env:
143168
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
144169

Diff for: CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to `twill` will be documented in this file.
44

5+
## 3.2.1
6+
7+
### Fixed
8+
- Fix datatable and buckets filters error caused by Axios breaking changes in 0.28.0 by @zeezo887 in https://github.com/area17/twill/pull/2520
9+
10+
511
## 3.2.0
612

713
### Added

Diff for: composer.json

+12-13
Original file line numberDiff line numberDiff line change
@@ -27,38 +27,37 @@
2727
"ext-json": "*",
2828
"ext-pdo": "*",
2929
"astrotomic/laravel-translatable": "^v11.12",
30-
"cartalyst/tags": "^12.0|^13.0",
30+
"cartalyst/tags": "^12.0 || ^13.0 || ^14.0",
3131
"doctrine/dbal": "^3.0",
3232
"guzzlehttp/guzzle": "^7.0",
3333
"imgix/imgix-php": "^3.0",
3434
"kalnoy/nestedset": "^6.0",
35-
"laravel/framework": "^9.0|^10.0",
35+
"laravel/framework": "^9.0 || ^10.0 || ^11.0",
3636
"laravel/socialite": "^5.3",
3737
"laravel/ui": "^4.0",
3838
"league/flysystem-aws-s3-v3": "^3.0",
39-
"league/glide-laravel": "^1.0",
39+
"league/glide-symfony": "^1.0 || ^2.0",
4040
"matthewbdaly/laravel-azure-storage": "^2.0",
4141
"myclabs/php-enum": "^1.5",
4242
"pragmarx/google2fa-qrcode": "^2.0",
4343
"spatie/laravel-activitylog": "^4.0",
44-
"spatie/laravel-analytics": "^4.0|^5.0",
44+
"spatie/laravel-analytics": "^4.0 || ^5.0",
4545
"spatie/once": "^3.0"
4646
},
4747
"require-dev": {
4848
"area17/phptorch": "dev-main",
4949
"chillerlan/php-qrcode": "~4.0",
5050
"friendsofphp/php-cs-fixer": "^3.0",
5151
"nette/php-generator": "^4.0.3",
52-
"nunomaduro/collision": "^6.0|^7.0|^8.0",
52+
"nunomaduro/collision": "^6.0 || ^7.0 || ^8.0",
5353
"nunomaduro/larastan": "^2.0",
54-
"orchestra/testbench": "^7.8|^8.0",
55-
"orchestra/testbench-dusk": "^7.8|^8.0",
56-
"phpunit/php-invoker": "^3.1",
57-
"phpunit/phpunit": "~9.0",
58-
"rector/rector": "^0.12.15",
54+
"orchestra/testbench": "^7.8 || ^8.0 || ^9.0",
55+
"orchestra/testbench-dusk": "^7.8 || ^8.0 || ^9.0",
56+
"phpunit/php-invoker": "^3.1 || ^4.0",
57+
"phpunit/phpunit": "~9.0 || ~10.0",
58+
"rector/rector": "^0.19.2 || ^1.0 ",
5959
"spatie/invade": "^1.1",
60-
"squizlabs/php_codesniffer": "*",
61-
"torchlight/torchlight-commonmark": "^0.5"
60+
"squizlabs/php_codesniffer": "*"
6261
},
6362
"autoload": {
6463
"psr-4": {
@@ -71,7 +70,7 @@
7170
"A17\\Twill\\Tests\\Integration\\": "tests/integration",
7271
"A17\\Twill\\Tests\\Browser\\": "tests/Browser",
7372
"A17\\Docs\\": "docs/generator",
74-
"App\\": "vendor/orchestra/testbench-core/laravel/app"
73+
"App\\": "vendor/orchestra/testbench-dusk/laravel/app"
7574
}
7675
},
7776
"scripts": {

Diff for: config/twill.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
|--------------------------------------------------------------------------
173173
|
174174
*/
175-
'auth_login_redirect_path' => '/',
175+
'auth_login_redirect_path' => null,
176176

177177
'templates_on_frontend_domain' => false,
178178

@@ -283,6 +283,14 @@
283283
*/
284284
'debug' => env('APP_DEBUG', false),
285285

286+
/*
287+
|--------------------------------------------------------------------------
288+
| This parameter will throw errors if some error occurs instead of failing
289+
| silently (eg. when rendering blocks)
290+
|--------------------------------------------------------------------------
291+
*/
292+
'strict' => env('TWILL_STRICT', false),
293+
286294
/*
287295
|--------------------------------------------------------------------------
288296
| Base classes for automatic generation of Modules and Capsules

Diff for: docs/content/1_docs/4_form-fields/15_conditional-fields.md

+141-12
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,38 @@ You can conditionally display fields based on the values of other fields in your
44
display a video embed text field only if the type of article, a radio field, is "video" you'd do something like the
55
following:
66

7+
8+
:::tabs=currenttab.FormBuilder&items.FormBuilder|FormView:::
9+
:::tab=name.FormBuilder:::
10+
11+
```php
12+
$form->add(\A17\Twill\Services\Forms\Fields\Radios::make()
13+
->name('type')
14+
->label('Article type')
15+
->inline()
16+
->default('long_form')
17+
->options([
18+
[
19+
'value' => 'long_form',
20+
'label' => 'Long form article'
21+
],
22+
[
23+
'value' => 'video',
24+
'label' => 'Video article'
25+
]
26+
])
27+
);
28+
29+
$form->add(\A17\Twill\Services\Forms\Fields\Input::make()
30+
->name('video_embed')
31+
->label('Video embed')
32+
->connectedTo('type', 'video')
33+
);
34+
```
35+
36+
:::#tab:::
37+
:::tab=name.FormView:::
38+
739
```blade
840
<x-twill::radios
941
name="type"
@@ -34,8 +66,30 @@ following:
3466
</x-twill::formConnectedFields>
3567
```
3668

69+
:::#tab:::
70+
:::#tabs:::
71+
3772
Here's an example based on a checkbox field where the value is either true or false:
3873

74+
75+
:::tabs=currenttab.FormBuilder&items.FormBuilder|FormView:::
76+
:::tab=name.FormBuilder:::
77+
78+
```php
79+
$form->add(\A17\Twill\Services\Forms\Fields\Checkbox::make()
80+
->name('vertical_article')
81+
->label('Vertical story')
82+
);
83+
84+
$form->add(\A17\Twill\Services\Forms\Fields\Medias::make()
85+
->name('vertical_image')
86+
->label('Vertical Image')
87+
->connectedTo('vertical_article', true)
88+
);
89+
```
90+
91+
:::#tab:::
92+
:::tab=name.FormView:::
3993
```blade
4094
<x-twill::checkbox
4195
name="vertical_article"
@@ -54,8 +108,47 @@ Here's an example based on a checkbox field where the value is either true or fa
54108
</x-twill::formConnectedFields>
55109
```
56110

111+
:::#tab:::
112+
:::#tabs:::
113+
57114
Here's an example based on a checkboxes field where the values are stored in a json field:
58115

116+
:::tabs=currenttab.FormBuilder&items.FormBuilder|Directive:::
117+
:::tab=name.FormBuilder:::
118+
119+
```php
120+
$form->add(\A17\Twill\Services\Forms\Fields\Checkboxes::make()
121+
->name('article_target')
122+
->label('Target')
123+
->min(1)->max(3)->inline()
124+
->options([
125+
[
126+
'value' => 'students',
127+
'label' => 'Students'
128+
],
129+
[
130+
'value' => 'teachers',
131+
'label' => 'Teachers'
132+
],
133+
[
134+
'value' => 'administration',
135+
'label' => 'Administration'
136+
]
137+
])
138+
);
139+
140+
$form->add(\A17\Twill\Services\Forms\Fields\Files::make()
141+
->name('attachment')
142+
->label('Attachment')
143+
->connectedTo('article_target', ['teachers', 'administration'], [
144+
'keepAlive' => true,
145+
'arrayContains' => true, // If you don't pass an array as fieldValues, set to false
146+
])
147+
);
148+
```
149+
150+
:::#tab:::
151+
:::tab=name.Directive:::
59152
```blade
60153
@formField('checkboxes', [
61154
'name' => 'article_target',
@@ -81,8 +174,9 @@ Here's an example based on a checkboxes field where the values are stored in a j
81174
82175
@formConnectedFields([
83176
'fieldName' => 'article_target',
84-
'fieldValues' => 'administration',
85-
'arrayContains' => false,
177+
'fieldValues' => ['administration', 'teachers'],
178+
'arrayContains' => true, // If you don't pass an array as fieldValues, set to false
179+
'keepAlive' => true,
86180
'renderForBlocks' => true/false # (depending on regular form vs block form)
87181
])
88182
@formField('files', [
@@ -91,9 +185,42 @@ Here's an example based on a checkboxes field where the values are stored in a j
91185
])
92186
@endformConnectedFields
93187
```
188+
:::#tab:::
189+
:::#tabs:::
94190

95191
Here's an example based on a browser field where the fields are displayed only when the browser field is not empty:
96192

193+
:::tabs=currenttab.FormBuilder&items.FormBuilder|FormView:::
194+
:::tab=name.FormBuilder:::
195+
196+
```php
197+
$form->add(\A17\Twill\Services\Forms\Fields\Browser::make()
198+
->name('related_publications')
199+
->label('Related publications')
200+
->max(4)
201+
->modules([Publications::class]))
202+
);
203+
204+
$form->add(\A17\Twill\Services\Forms\Fields\Input::make()
205+
->name('related_publications_header')
206+
->label('Related publications header')
207+
->connectedTo('article_publications', true, [
208+
'isBrowser' => true,
209+
'keepAlive' => true,
210+
])
211+
);
212+
$form->add(\A17\Twill\Services\Forms\Fields\Input::make()
213+
->name('related_publications_copy')
214+
->label('Related publications copy')
215+
->connectedTo('article_publications', true, [
216+
'isBrowser' => true,
217+
'keepAlive' => true,
218+
])
219+
);
220+
```
221+
222+
:::#tab:::
223+
:::tab=name.FormView:::
97224
```blade
98225
<x-twill::browser
99226
module-name="publication"
@@ -117,14 +244,16 @@ Here's an example based on a browser field where the fields are displayed only w
117244
/>
118245
</x-twill::formConnectedFields>
119246
```
247+
:::#tab:::
248+
:::#tabs:::
120249

121-
| Option | Description | Type | Default value |
122-
|:------------------|:-------------------------------------------------------------------------------------------------|:------------------|:--------------|
123-
| fieldName | Name of the connected field | string | |
124-
| fieldValues | Value or values of the connected field that will reveal the fields in this component's slot | string&vert;array | |
125-
| isEqual | Controls how `fieldValues` are evaluated against the connected field | boolean | true |
126-
| isBrowser | Indicates that the connected field is a `browser` field | boolean | false |
127-
| arrayContains | Controls how `fieldValues` are evaluated when connected field is an array | boolean | true |
128-
| matchEmptyBrowser | When set to true, the fields in this component's slot will be revealed when the browser is empty | boolean | false |
129-
| keepAlive | When set to true, the state of the hidden fields is preserved | boolean | false |
130-
| renderForBlocks | When used inside a block, this needs to be set to true | string | false |
250+
| Option | Description | Type | Default value |
251+
|:------------------|:--------------------------------------------------------------------------------------------------------------|:------------------|:--------------|
252+
| fieldName | Name of the connected field | string | |
253+
| fieldValues | Value or values of the connected field that will reveal the fields in this component's slot | string&vert;array | |
254+
| isEqual | Controls how `fieldValues` are evaluated against the connected field | boolean | true |
255+
| isBrowser | Indicates that the connected field is a `browser` field | boolean | false |
256+
| arrayContains | Controls how `fieldValues` are evaluated when connected field is an array | boolean | true |
257+
| matchEmptyBrowser | When set to true, the fields in this component's slot will be revealed when the browser is empty | boolean | false |
258+
| keepAlive | When set to true, the state of the hidden fields is preserved | boolean | false |
259+
| renderForBlocks | When used inside a block, this needs to be set to true (this is automatically set when using the FormBuilder) | string | false |

Diff for: docs/content/1_docs/9_buckets/1_index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ Finally, add a link to your buckets page in your CMS navigation:
6666
return [
6767
'featured' => [
6868
'title' => 'Features',
69-
'route' => 'admin.featured.homepage',
69+
'route' => 'twill.featured.homepage',
7070
'primary_navigation' => [
7171
'homepage' => [
7272
'title' => 'Homepage',
73-
'route' => 'admin.featured.homepage',
73+
'route' => 'twill.featured.homepage',
7474
],
7575
],
7676
],

Diff for: docs/content/2_guides/1_page-builder-with-blade/4_creating-the-page-module.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ return new class extends Migration
254254
```
255255

256256
This file will create the minimum required tables and columns that Twill uses to provide the CMS functionality. Later in
257-
the guide we may add some more fields to the database, but will will do that in a new migration.
257+
the guide we may add some more fields to the database, but we will do that in a new migration.
258258

259259
Once you are more experienced with Twill, you may want to add fields at this moment, before you run the migrate command.
260260
That way, you do not have to immediately add a new migration file.

0 commit comments

Comments
 (0)