From ee9d9ee2cb5a1d2c577716054d0ad738e67c4b9e Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Wed, 6 Nov 2024 11:22:32 -0500 Subject: [PATCH 01/23] [5.x] Offer to enable Pro during make user command (#11071) --- src/Console/Commands/MakeUser.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Console/Commands/MakeUser.php b/src/Console/Commands/MakeUser.php index a3aa0f9f76..2bdf677ef2 100644 --- a/src/Console/Commands/MakeUser.php +++ b/src/Console/Commands/MakeUser.php @@ -71,7 +71,13 @@ class MakeUser extends Command public function handle() { if (! Statamic::pro() && User::query()->count() > 0) { - return error(__('Statamic Pro is required.')); + error(__('Statamic Pro is required.')); + + if (confirm(__('Enable Statamic Pro?'))) { + $this->call('statamic:pro:enable'); + } else { + return self::SUCCESS; + } } if ($password = $this->option('password')) { From 89fab652b47046c344c4094b29880c644e14d183 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Wed, 6 Nov 2024 11:55:01 -0500 Subject: [PATCH 02/23] [5.x] Fix Ignition Runnable Error Solutions (#11072) --- src/Exceptions/ComposerJsonMissingPreUpdateCmdException.php | 2 +- src/Exceptions/StatamicProRequiredException.php | 4 ++-- src/Ignition/Solutions/EnableComposerUpdateScripts.php | 2 +- src/Ignition/Solutions/EnableStatamicPro.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Exceptions/ComposerJsonMissingPreUpdateCmdException.php b/src/Exceptions/ComposerJsonMissingPreUpdateCmdException.php index d4e09f2233..32cf920884 100644 --- a/src/Exceptions/ComposerJsonMissingPreUpdateCmdException.php +++ b/src/Exceptions/ComposerJsonMissingPreUpdateCmdException.php @@ -3,8 +3,8 @@ namespace Statamic\Exceptions; use Exception; +use Spatie\ErrorSolutions\Contracts\Solution; use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; use Statamic\Ignition\Solutions\EnableComposerUpdateScripts; class ComposerJsonMissingPreUpdateCmdException extends Exception implements ProvidesSolution diff --git a/src/Exceptions/StatamicProRequiredException.php b/src/Exceptions/StatamicProRequiredException.php index f480fbd817..72b111da5b 100644 --- a/src/Exceptions/StatamicProRequiredException.php +++ b/src/Exceptions/StatamicProRequiredException.php @@ -3,8 +3,8 @@ namespace Statamic\Exceptions; use Exception; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; use Statamic\Ignition\Solutions\EnableStatamicPro; class StatamicProRequiredException extends Exception implements ProvidesSolution diff --git a/src/Ignition/Solutions/EnableComposerUpdateScripts.php b/src/Ignition/Solutions/EnableComposerUpdateScripts.php index 89e39efe0f..97292a8036 100644 --- a/src/Ignition/Solutions/EnableComposerUpdateScripts.php +++ b/src/Ignition/Solutions/EnableComposerUpdateScripts.php @@ -4,7 +4,7 @@ use Exception; use Facades\Statamic\UpdateScripts\Manager as UpdateScriptManager; -use Spatie\Ignition\Contracts\RunnableSolution; +use Spatie\ErrorSolutions\Contracts\RunnableSolution; use Statamic\Console\Composer\Json as ComposerJson; use Statamic\Console\NullConsole; use Statamic\Statamic; diff --git a/src/Ignition/Solutions/EnableStatamicPro.php b/src/Ignition/Solutions/EnableStatamicPro.php index 9fbca9267e..fd02982ffb 100644 --- a/src/Ignition/Solutions/EnableStatamicPro.php +++ b/src/Ignition/Solutions/EnableStatamicPro.php @@ -2,7 +2,7 @@ namespace Statamic\Ignition\Solutions; -use Spatie\Ignition\Contracts\RunnableSolution; +use Spatie\ErrorSolutions\Contracts\RunnableSolution; use Statamic\Statamic; class EnableStatamicPro implements RunnableSolution From d8d09d195d840f9d1505254cef1cb70b408de41e Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Wed, 6 Nov 2024 17:45:36 +0000 Subject: [PATCH 03/23] [5.x] Update addon `.gitignore` stub (#11068) --- src/Console/Commands/stubs/addon/.gitignore.stub | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Console/Commands/stubs/addon/.gitignore.stub b/src/Console/Commands/stubs/addon/.gitignore.stub index 0199b2f8a3..649b0db2bb 100644 --- a/src/Console/Commands/stubs/addon/.gitignore.stub +++ b/src/Console/Commands/stubs/addon/.gitignore.stub @@ -1,3 +1,4 @@ node_modules vendor -mix-manifest.json +composer.lock +.phpunit.result.cache From ad32277b501c6ffcdb628c3c1d065a686bdf243c Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Wed, 6 Nov 2024 19:38:05 +0000 Subject: [PATCH 04/23] [5.x] Integer fields should render with `type="number"` (#11065) --- .../views/extend/forms/fields/integer.antlers.html | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 resources/views/extend/forms/fields/integer.antlers.html diff --git a/resources/views/extend/forms/fields/integer.antlers.html b/resources/views/extend/forms/fields/integer.antlers.html new file mode 100644 index 0000000000..8392cb99a9 --- /dev/null +++ b/resources/views/extend/forms/fields/integer.antlers.html @@ -0,0 +1,10 @@ + From f01281268ae2fec73d52954dc536998db7d9c2a1 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Wed, 6 Nov 2024 14:44:21 -0500 Subject: [PATCH 05/23] [5.x] Adjust legacy ignition classes (#11073) --- composer.json | 2 +- src/Exceptions/AssetContainerNotFoundException.php | 8 ++++---- src/Exceptions/BlueprintNotFoundException.php | 8 ++++---- src/Exceptions/CollectionNotFoundException.php | 8 ++++---- .../ComposerJsonMissingPreUpdateCmdException.php | 2 +- src/Exceptions/DuplicateFieldException.php | 6 +++--- src/Exceptions/FieldsetNotFoundException.php | 8 ++++---- src/Exceptions/FieldsetRecursionException.php | 6 +++--- src/Exceptions/FieldtypeNotFoundException.php | 8 ++++---- src/Exceptions/NavigationNotFoundException.php | 8 ++++---- src/Exceptions/NotBootedException.php | 6 +++--- src/Exceptions/SiteNotFoundException.php | 6 +++--- src/Exceptions/TaxonomyNotFoundException.php | 8 ++++---- src/Exceptions/TermsFieldtypeBothOptionsUsedException.php | 6 +++--- src/Exceptions/TermsFieldtypeTaxonomyOptionUsed.php | 6 +++--- src/Fieldtypes/Assets/UndefinedContainerException.php | 6 +++--- src/Fieldtypes/MultipleValuesEncounteredException.php | 6 +++--- src/Forms/Exceptions/BlueprintUndefinedException.php | 6 +++--- src/Forms/Exceptions/FileContentTypeRequiredException.php | 6 +++--- src/Ignition/SolutionProviders/OAuthDisabled.php | 2 +- src/Ignition/SolutionProviders/UsingOldClass.php | 2 +- src/Ignition/Solutions/EnableOAuth.php | 2 +- src/Ignition/Solutions/UpdateClassReference.php | 2 +- src/Modifiers/ModifierNotFoundException.php | 8 ++++---- src/Providers/IgnitionServiceProvider.php | 2 +- src/View/Antlers/Language/Runtime/RuntimeParser.php | 2 +- src/Widgets/WidgetNotFoundException.php | 8 ++++---- src/Yaml/ParseException.php | 6 +++--- 28 files changed, 77 insertions(+), 77 deletions(-) diff --git a/composer.json b/composer.json index 9a87a4d88f..53c2e4921d 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "rebing/graphql-laravel": "^9.5", "rhukster/dom-sanitizer": "^1.0.6", "spatie/blink": "^1.3", - "spatie/ignition": "^1.12", + "spatie/ignition": "^1.15", "statamic/stringy": "^3.1.2", "stillat/blade-parser": "^1.10.1", "symfony/lock": "^6.4", diff --git a/src/Exceptions/AssetContainerNotFoundException.php b/src/Exceptions/AssetContainerNotFoundException.php index 7135716ee2..52a7d6587c 100644 --- a/src/Exceptions/AssetContainerNotFoundException.php +++ b/src/Exceptions/AssetContainerNotFoundException.php @@ -3,10 +3,10 @@ namespace Statamic\Exceptions; use Exception; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; -use Spatie\LaravelIgnition\Support\StringComparator; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; +use Spatie\ErrorSolutions\Support\Laravel\StringComparator; use Statamic\Facades\AssetContainer; use Statamic\Statamic; diff --git a/src/Exceptions/BlueprintNotFoundException.php b/src/Exceptions/BlueprintNotFoundException.php index 37ddd7235f..0587b529dc 100644 --- a/src/Exceptions/BlueprintNotFoundException.php +++ b/src/Exceptions/BlueprintNotFoundException.php @@ -3,10 +3,10 @@ namespace Statamic\Exceptions; use Exception; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; -use Spatie\LaravelIgnition\Support\StringComparator; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; +use Spatie\ErrorSolutions\Support\Laravel\StringComparator; use Statamic\Facades\Blueprint; use Statamic\Statamic; diff --git a/src/Exceptions/CollectionNotFoundException.php b/src/Exceptions/CollectionNotFoundException.php index 05fd66a70a..8930d7a837 100644 --- a/src/Exceptions/CollectionNotFoundException.php +++ b/src/Exceptions/CollectionNotFoundException.php @@ -3,10 +3,10 @@ namespace Statamic\Exceptions; use Exception; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; -use Spatie\LaravelIgnition\Support\StringComparator; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; +use Spatie\ErrorSolutions\Support\Laravel\StringComparator; use Statamic\Facades\Collection; use Statamic\Statamic; diff --git a/src/Exceptions/ComposerJsonMissingPreUpdateCmdException.php b/src/Exceptions/ComposerJsonMissingPreUpdateCmdException.php index 32cf920884..a7fffd4164 100644 --- a/src/Exceptions/ComposerJsonMissingPreUpdateCmdException.php +++ b/src/Exceptions/ComposerJsonMissingPreUpdateCmdException.php @@ -3,8 +3,8 @@ namespace Statamic\Exceptions; use Exception; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; use Spatie\ErrorSolutions\Contracts\Solution; -use Spatie\Ignition\Contracts\ProvidesSolution; use Statamic\Ignition\Solutions\EnableComposerUpdateScripts; class ComposerJsonMissingPreUpdateCmdException extends Exception implements ProvidesSolution diff --git a/src/Exceptions/DuplicateFieldException.php b/src/Exceptions/DuplicateFieldException.php index d330ef868d..b4d9a4bc4e 100644 --- a/src/Exceptions/DuplicateFieldException.php +++ b/src/Exceptions/DuplicateFieldException.php @@ -2,9 +2,9 @@ namespace Statamic\Exceptions; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; use Statamic\Statamic; class DuplicateFieldException extends \Exception implements ProvidesSolution diff --git a/src/Exceptions/FieldsetNotFoundException.php b/src/Exceptions/FieldsetNotFoundException.php index dcd64a4f4f..5430832fd0 100644 --- a/src/Exceptions/FieldsetNotFoundException.php +++ b/src/Exceptions/FieldsetNotFoundException.php @@ -3,10 +3,10 @@ namespace Statamic\Exceptions; use Exception; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; -use Spatie\LaravelIgnition\Support\StringComparator; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; +use Spatie\ErrorSolutions\Support\Laravel\StringComparator; use Statamic\Facades\Fieldset; use Statamic\Statamic; diff --git a/src/Exceptions/FieldsetRecursionException.php b/src/Exceptions/FieldsetRecursionException.php index 59b6838dcb..68afdc5743 100644 --- a/src/Exceptions/FieldsetRecursionException.php +++ b/src/Exceptions/FieldsetRecursionException.php @@ -3,9 +3,9 @@ namespace Statamic\Exceptions; use Exception; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; class FieldsetRecursionException extends Exception implements ProvidesSolution { diff --git a/src/Exceptions/FieldtypeNotFoundException.php b/src/Exceptions/FieldtypeNotFoundException.php index 300d328495..8b4f432e6a 100644 --- a/src/Exceptions/FieldtypeNotFoundException.php +++ b/src/Exceptions/FieldtypeNotFoundException.php @@ -4,10 +4,10 @@ use Exception; use Facades\Statamic\Fields\FieldtypeRepository; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; -use Spatie\LaravelIgnition\Support\StringComparator; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; +use Spatie\ErrorSolutions\Support\Laravel\StringComparator; use Statamic\Statamic; class FieldtypeNotFoundException extends Exception implements ProvidesSolution diff --git a/src/Exceptions/NavigationNotFoundException.php b/src/Exceptions/NavigationNotFoundException.php index 565b1edb23..112dae3cbb 100644 --- a/src/Exceptions/NavigationNotFoundException.php +++ b/src/Exceptions/NavigationNotFoundException.php @@ -3,10 +3,10 @@ namespace Statamic\Exceptions; use Exception; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; -use Spatie\LaravelIgnition\Support\StringComparator; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; +use Spatie\ErrorSolutions\Support\Laravel\StringComparator; use Statamic\Facades\Nav; use Statamic\Statamic; diff --git a/src/Exceptions/NotBootedException.php b/src/Exceptions/NotBootedException.php index 214255304d..d1389ce8cd 100644 --- a/src/Exceptions/NotBootedException.php +++ b/src/Exceptions/NotBootedException.php @@ -3,9 +3,9 @@ namespace Statamic\Exceptions; use Exception; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; use Statamic\Statamic; class NotBootedException extends Exception implements ProvidesSolution diff --git a/src/Exceptions/SiteNotFoundException.php b/src/Exceptions/SiteNotFoundException.php index 45387c7621..df92ac1f8c 100644 --- a/src/Exceptions/SiteNotFoundException.php +++ b/src/Exceptions/SiteNotFoundException.php @@ -3,9 +3,9 @@ namespace Statamic\Exceptions; use Exception; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; use Statamic\Statamic; class SiteNotFoundException extends Exception implements ProvidesSolution diff --git a/src/Exceptions/TaxonomyNotFoundException.php b/src/Exceptions/TaxonomyNotFoundException.php index f56626854f..7103669b82 100644 --- a/src/Exceptions/TaxonomyNotFoundException.php +++ b/src/Exceptions/TaxonomyNotFoundException.php @@ -3,10 +3,10 @@ namespace Statamic\Exceptions; use Exception; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; -use Spatie\LaravelIgnition\Support\StringComparator; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; +use Spatie\ErrorSolutions\Support\Laravel\StringComparator; use Statamic\Facades\Taxonomy; use Statamic\Statamic; diff --git a/src/Exceptions/TermsFieldtypeBothOptionsUsedException.php b/src/Exceptions/TermsFieldtypeBothOptionsUsedException.php index 0ee64ae78b..ad71c3b2c8 100644 --- a/src/Exceptions/TermsFieldtypeBothOptionsUsedException.php +++ b/src/Exceptions/TermsFieldtypeBothOptionsUsedException.php @@ -3,9 +3,9 @@ namespace Statamic\Exceptions; use Exception; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; use Statamic\Statamic; class TermsFieldtypeBothOptionsUsedException extends Exception implements ProvidesSolution diff --git a/src/Exceptions/TermsFieldtypeTaxonomyOptionUsed.php b/src/Exceptions/TermsFieldtypeTaxonomyOptionUsed.php index 792079315d..c29f59eb1c 100644 --- a/src/Exceptions/TermsFieldtypeTaxonomyOptionUsed.php +++ b/src/Exceptions/TermsFieldtypeTaxonomyOptionUsed.php @@ -3,9 +3,9 @@ namespace Statamic\Exceptions; use Exception; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; use Statamic\Statamic; class TermsFieldtypeTaxonomyOptionUsed extends Exception implements ProvidesSolution diff --git a/src/Fieldtypes/Assets/UndefinedContainerException.php b/src/Fieldtypes/Assets/UndefinedContainerException.php index da09780ac1..2f5b647ba1 100644 --- a/src/Fieldtypes/Assets/UndefinedContainerException.php +++ b/src/Fieldtypes/Assets/UndefinedContainerException.php @@ -3,9 +3,9 @@ namespace Statamic\Fieldtypes\Assets; use LogicException; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; use Statamic\Statamic; class UndefinedContainerException extends LogicException implements ProvidesSolution diff --git a/src/Fieldtypes/MultipleValuesEncounteredException.php b/src/Fieldtypes/MultipleValuesEncounteredException.php index 6a885d5cbd..b9babc68f0 100644 --- a/src/Fieldtypes/MultipleValuesEncounteredException.php +++ b/src/Fieldtypes/MultipleValuesEncounteredException.php @@ -3,9 +3,9 @@ namespace Statamic\Fieldtypes; use Exception; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; class MultipleValuesEncounteredException extends Exception implements ProvidesSolution { diff --git a/src/Forms/Exceptions/BlueprintUndefinedException.php b/src/Forms/Exceptions/BlueprintUndefinedException.php index e96fe23ca3..15a687e99b 100644 --- a/src/Forms/Exceptions/BlueprintUndefinedException.php +++ b/src/Forms/Exceptions/BlueprintUndefinedException.php @@ -3,9 +3,9 @@ namespace Statamic\Forms\Exceptions; use LogicException; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; use Statamic\Forms\Form; use Statamic\Statamic; diff --git a/src/Forms/Exceptions/FileContentTypeRequiredException.php b/src/Forms/Exceptions/FileContentTypeRequiredException.php index f1b2ceea00..481cb520ed 100644 --- a/src/Forms/Exceptions/FileContentTypeRequiredException.php +++ b/src/Forms/Exceptions/FileContentTypeRequiredException.php @@ -3,9 +3,9 @@ namespace Statamic\Forms\Exceptions; use LogicException; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; use Statamic\Statamic; class FileContentTypeRequiredException extends LogicException implements ProvidesSolution diff --git a/src/Ignition/SolutionProviders/OAuthDisabled.php b/src/Ignition/SolutionProviders/OAuthDisabled.php index 49d3aaaa1c..343d63ebdc 100644 --- a/src/Ignition/SolutionProviders/OAuthDisabled.php +++ b/src/Ignition/SolutionProviders/OAuthDisabled.php @@ -2,7 +2,7 @@ namespace Statamic\Ignition\SolutionProviders; -use Spatie\Ignition\Contracts\HasSolutionsForThrowable; +use Spatie\ErrorSolutions\Contracts\HasSolutionsForThrowable; use Statamic\Ignition\Solutions\EnableOAuth; use Throwable; diff --git a/src/Ignition/SolutionProviders/UsingOldClass.php b/src/Ignition/SolutionProviders/UsingOldClass.php index 7706d4b72d..2a990fa949 100644 --- a/src/Ignition/SolutionProviders/UsingOldClass.php +++ b/src/Ignition/SolutionProviders/UsingOldClass.php @@ -2,7 +2,7 @@ namespace Statamic\Ignition\SolutionProviders; -use Spatie\Ignition\Contracts\HasSolutionsForThrowable; +use Spatie\ErrorSolutions\Contracts\HasSolutionsForThrowable; use Statamic\Ignition\Solutions\UpdateClassReference; use Statamic\Statamic; use Statamic\Support\Arr; diff --git a/src/Ignition/Solutions/EnableOAuth.php b/src/Ignition/Solutions/EnableOAuth.php index bcfed642ac..d3242b52e0 100644 --- a/src/Ignition/Solutions/EnableOAuth.php +++ b/src/Ignition/Solutions/EnableOAuth.php @@ -2,7 +2,7 @@ namespace Statamic\Ignition\Solutions; -use Spatie\Ignition\Contracts\Solution; +use Spatie\ErrorSolutions\Contracts\Solution; use Statamic\Statamic; class EnableOAuth implements Solution diff --git a/src/Ignition/Solutions/UpdateClassReference.php b/src/Ignition/Solutions/UpdateClassReference.php index a946d55368..84567ea1ae 100644 --- a/src/Ignition/Solutions/UpdateClassReference.php +++ b/src/Ignition/Solutions/UpdateClassReference.php @@ -2,7 +2,7 @@ namespace Statamic\Ignition\Solutions; -use Spatie\Ignition\Contracts\Solution; +use Spatie\ErrorSolutions\Contracts\Solution; class UpdateClassReference implements Solution { diff --git a/src/Modifiers/ModifierNotFoundException.php b/src/Modifiers/ModifierNotFoundException.php index 9f87fdfd89..691fc1d08b 100644 --- a/src/Modifiers/ModifierNotFoundException.php +++ b/src/Modifiers/ModifierNotFoundException.php @@ -3,10 +3,10 @@ namespace Statamic\Modifiers; use Exception; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; -use Spatie\LaravelIgnition\Support\StringComparator; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; +use Spatie\ErrorSolutions\Support\Laravel\StringComparator; use Statamic\Statamic; class ModifierNotFoundException extends Exception implements ProvidesSolution diff --git a/src/Providers/IgnitionServiceProvider.php b/src/Providers/IgnitionServiceProvider.php index 089f6310ea..5442379842 100644 --- a/src/Providers/IgnitionServiceProvider.php +++ b/src/Providers/IgnitionServiceProvider.php @@ -4,7 +4,7 @@ use Illuminate\Contracts\Container\BindingResolutionException; use Illuminate\Support\ServiceProvider; -use Spatie\Ignition\Contracts\SolutionProviderRepository; +use Spatie\ErrorSolutions\Contracts\SolutionProviderRepository; use Statamic\Ignition\SolutionProviders\OAuthDisabled; use Statamic\Ignition\SolutionProviders\UsingOldClass; diff --git a/src/View/Antlers/Language/Runtime/RuntimeParser.php b/src/View/Antlers/Language/Runtime/RuntimeParser.php index d6acdcad14..7df144a7da 100644 --- a/src/View/Antlers/Language/Runtime/RuntimeParser.php +++ b/src/View/Antlers/Language/Runtime/RuntimeParser.php @@ -4,7 +4,7 @@ use Illuminate\Http\Exceptions\HttpResponseException; use ReflectionProperty; -use Spatie\Ignition\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; use Spatie\LaravelIgnition\Exceptions\ViewException; use Spatie\LaravelIgnition\Exceptions\ViewExceptionWithSolution; use Statamic\Contracts\View\Antlers\Parser; diff --git a/src/Widgets/WidgetNotFoundException.php b/src/Widgets/WidgetNotFoundException.php index b7f28d4643..d22f5ec8b1 100644 --- a/src/Widgets/WidgetNotFoundException.php +++ b/src/Widgets/WidgetNotFoundException.php @@ -3,10 +3,10 @@ namespace Statamic\Widgets; use Exception; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; -use Spatie\LaravelIgnition\Support\StringComparator; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; +use Spatie\ErrorSolutions\Support\Laravel\StringComparator; use Statamic\Statamic; class WidgetNotFoundException extends Exception implements ProvidesSolution diff --git a/src/Yaml/ParseException.php b/src/Yaml/ParseException.php index 21fee9d002..6f20d3206a 100644 --- a/src/Yaml/ParseException.php +++ b/src/Yaml/ParseException.php @@ -3,9 +3,9 @@ namespace Statamic\Yaml; use ErrorException; -use Spatie\Ignition\Contracts\BaseSolution; -use Spatie\Ignition\Contracts\ProvidesSolution; -use Spatie\Ignition\Contracts\Solution; +use Spatie\ErrorSolutions\Contracts\BaseSolution; +use Spatie\ErrorSolutions\Contracts\ProvidesSolution; +use Spatie\ErrorSolutions\Contracts\Solution; use Statamic\Statamic; class ParseException extends ErrorException implements ProvidesSolution From 16bb31507c5e6432eb896e48d16c4187e300c8c0 Mon Sep 17 00:00:00 2001 From: Jesse Leite Date: Wed, 6 Nov 2024 16:40:47 -0500 Subject: [PATCH 06/23] [5.x] Add `--clear` option for `starter-kit:export` (#11079) --- src/Console/Commands/StarterKitExport.php | 7 +++- src/StarterKits/Exporter.php | 27 +++++++++++++- src/StarterKits/Installer.php | 10 ----- tests/StarterKits/ExportTest.php | 45 +++++++++++++++++++++-- 4 files changed, 73 insertions(+), 16 deletions(-) diff --git a/src/Console/Commands/StarterKitExport.php b/src/Console/Commands/StarterKitExport.php index 2c2cb31114..3545c1e743 100644 --- a/src/Console/Commands/StarterKitExport.php +++ b/src/Console/Commands/StarterKitExport.php @@ -20,7 +20,9 @@ class StarterKitExport extends Command * * @var string */ - protected $signature = 'statamic:starter-kit:export { path : Specify the path you are exporting to }'; + protected $signature = 'statamic:starter-kit:export + { path : Specify the path you are exporting to } + { --clear : Clear out everything at target export path before exporting }'; /** * The console command description. @@ -42,7 +44,8 @@ public function handle() $this->askToCreateExportPath($path); } - $exporter = new StarterKitExporter($path); + $exporter = (new StarterKitExporter($path)) + ->clear($this->option('clear')); try { $exporter->export(); diff --git a/src/StarterKits/Exporter.php b/src/StarterKits/Exporter.php index a62a54f996..51fe16346e 100644 --- a/src/StarterKits/Exporter.php +++ b/src/StarterKits/Exporter.php @@ -9,12 +9,14 @@ use Statamic\StarterKits\Exceptions\StarterKitException; use Statamic\Support\Arr; use Statamic\Support\Str; +use Statamic\Support\Traits\FluentlyGetsAndSets; class Exporter { - use InteractsWithFilesystem; + use FluentlyGetsAndSets, InteractsWithFilesystem; protected $exportPath; + protected $clear; protected $files; protected $vendorName; protected $modules; @@ -29,6 +31,14 @@ public function __construct(string $exportPath) $this->files = app(Filesystem::class); } + /** + * Get or set whether to clear out everything at target export path before exporting. + */ + public function clear(bool $clear = false): self|bool|null + { + return $this->fluentlyGetOrSet('clear')->args(func_get_args()); + } + /** * Export starter kit. * @@ -40,6 +50,7 @@ public function export(): void ->validateExportPath() ->validateConfig() ->instantiateModules() + ->clearExportPath() ->exportModules() ->exportConfig() ->exportHooks() @@ -132,6 +143,20 @@ protected function normalizeModuleKey(string $key, string $childKey): string return $key !== 'top_level' ? "{$key}.modules.{$childKey}" : $childKey; } + /** + * Optionally clear out everything at target export path before exporting. + */ + protected function clearExportPath() + { + if (! $this->clear) { + return $this; + } + + $this->files->cleanDirectory($this->exportPath); + + return $this; + } + /** * Export all the modules. */ diff --git a/src/StarterKits/Installer.php b/src/StarterKits/Installer.php index a17f8adfc3..0f95af244a 100644 --- a/src/StarterKits/Installer.php +++ b/src/StarterKits/Installer.php @@ -63,8 +63,6 @@ public function __construct(string $package, ?Command $console = null, ?LicenseM public function branch(?string $branch = null): self|bool|null { return $this->fluentlyGetOrSet('branch')->args(func_get_args()); - - return $this; } /** @@ -73,8 +71,6 @@ public function branch(?string $branch = null): self|bool|null public function fromLocalRepo(bool $fromLocalRepo = false): self|bool|null { return $this->fluentlyGetOrSet('fromLocalRepo')->args(func_get_args()); - - return $this; } /** @@ -83,8 +79,6 @@ public function fromLocalRepo(bool $fromLocalRepo = false): self|bool|null public function withConfig(bool $withConfig = false): self|bool|null { return $this->fluentlyGetOrSet('withConfig')->args(func_get_args()); - - return $this; } /** @@ -101,8 +95,6 @@ public function withoutDependencies(?bool $withoutDependencies = false): self|bo public function withUserPrompt(bool $withUserPrompt = false): self|bool|null { return $this->fluentlyGetOrSet('withUserPrompt')->args(func_get_args()); - - return $this; } /** @@ -119,8 +111,6 @@ public function isInteractive($isInteractive = false): self|bool|null public function usingSubProcess(bool $usingSubProcess = false): self|bool|null { return $this->fluentlyGetOrSet('usingSubProcess')->args(func_get_args()); - - return $this; } /** diff --git a/tests/StarterKits/ExportTest.php b/tests/StarterKits/ExportTest.php index 75d4d4d69c..59130fde1b 100644 --- a/tests/StarterKits/ExportTest.php +++ b/tests/StarterKits/ExportTest.php @@ -149,6 +149,45 @@ public function it_can_export_as_to_different_destination_path() $this->cleanPaths($paths); } + #[Test] + public function it_can_clear_target_export_path_with_clear_option() + { + $paths = $this->cleanPaths([ + base_path('one'), + base_path('two'), + ]); + + // Imagine this exists from previous export + $this->files->makeDirectory($this->exportPath('one'), 0777, true, true); + $this->files->put($this->exportPath('one/file.md'), 'One.'); + + $this->files->makeDirectory(base_path('two'), 0777, true, true); + $this->files->put(base_path('two/file.md'), 'Two.'); + + $this->setExportPaths([ + 'two/file.md', + ]); + + $this->assertFileExists($this->exportPath('one')); + $this->assertFileDoesNotExist($this->exportPath('two')); + + $this->exportCoolRunnings(); + + // Our 'one' folder should exist after exporting normally + $this->assertFileExists($this->exportPath('one')); + $this->assertFileExists($this->exportPath('two')); + + $this->exportCoolRunnings(['--clear' => true]); + + // But 'one' folder should exist after exporting with `--clear` option + $this->assertFileDoesNotExist($this->exportPath('one')); + $this->assertFileExists($this->exportPath('two')); + + $this->exportCoolRunnings(); + + $this->cleanPaths($paths); + } + #[Test] public function it_copies_export_config() { @@ -1533,12 +1572,12 @@ private function assertConfigSameOrder($expectedConfig) ); } - private function exportCoolRunnings() + private function exportCoolRunnings($options = []) { - return $this->artisan('statamic:starter-kit:export', [ + return $this->artisan('statamic:starter-kit:export', array_merge([ 'path' => '../cool-runnings', '--no-interaction' => true, - ]); + ], $options)); } private function assertFileHasContent($expected, $path) From 9b4302c47ce733873ad351b53abd64ca475c5040 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Wed, 6 Nov 2024 16:47:23 -0500 Subject: [PATCH 07/23] [5.x] Extra values for entry field conditions, including depth (#11080) --- resources/js/components/entries/BaseCreateForm.vue | 2 ++ resources/js/components/entries/PublishForm.vue | 5 +++++ resources/js/components/publish/Container.vue | 14 ++++++++++++++ resources/views/entries/create.blade.php | 1 + resources/views/entries/edit.blade.php | 1 + src/Fieldtypes/Entries.php | 1 + .../CP/Collections/EntriesController.php | 9 +++++++-- .../CP/Collections/ExtractsFromEntryFields.php | 6 +++++- 8 files changed, 36 insertions(+), 3 deletions(-) diff --git a/resources/js/components/entries/BaseCreateForm.vue b/resources/js/components/entries/BaseCreateForm.vue index d2594cca09..7970232f62 100644 --- a/resources/js/components/entries/BaseCreateForm.vue +++ b/resources/js/components/entries/BaseCreateForm.vue @@ -10,6 +10,7 @@ :collection-has-routes="collectionHasRoutes" :initial-fieldset="fieldset" :initial-values="values" + :initial-extra-values="extraValues" :initial-meta="meta" :initial-localizations="localizations" :initial-has-origin="false" @@ -37,6 +38,7 @@ export default { 'collectionHasRoutes', 'fieldset', 'values', + 'extraValues', 'meta', 'localizations', 'revisions', diff --git a/resources/js/components/entries/PublishForm.vue b/resources/js/components/entries/PublishForm.vue index 0c8dd19a53..2f8d0b9d53 100644 --- a/resources/js/components/entries/PublishForm.vue +++ b/resources/js/components/entries/PublishForm.vue @@ -68,6 +68,7 @@ :name="publishContainer" :blueprint="fieldset" :values="values" + :extra-values="extraValues" :reference="initialReference" :meta="meta" :errors="errors" @@ -335,6 +336,7 @@ export default { initialReference: String, initialFieldset: Object, initialValues: Object, + initialExtraValues: Object, initialMeta: Object, initialTitle: String, initialLocalizations: Array, @@ -375,6 +377,7 @@ export default { title: this.initialTitle, values: _.clone(this.initialValues), meta: _.clone(this.initialMeta), + extraValues: _.clone(this.initialExtraValues), localizations: _.clone(this.initialLocalizations), localizedFields: this.initialLocalizedFields, hasOrigin: this.initialHasOrigin, @@ -606,6 +609,7 @@ export default { clearTimeout(this.trackDirtyStateTimeout) this.trackDirtyState = false this.values = this.resetValuesFromResponse(response.data.data.values); + this.extraValues = response.data.data.extraValues; this.trackDirtyStateTimeout = setTimeout(() => (this.trackDirtyState = true), 500) this.$nextTick(() => this.$emit('saved', response)); return; @@ -630,6 +634,7 @@ export default { clearTimeout(this.trackDirtyStateTimeout); this.trackDirtyState = false; this.values = this.resetValuesFromResponse(response.data.data.values); + this.extraValues = response.data.data.extraValues; this.trackDirtyStateTimeout = setTimeout(() => (this.trackDirtyState = true), 500); this.initialPublished = response.data.data.published; this.activeLocalization.published = response.data.data.published; diff --git a/resources/js/components/publish/Container.vue b/resources/js/components/publish/Container.vue index 5429ac5206..c02f4d45de 100644 --- a/resources/js/components/publish/Container.vue +++ b/resources/js/components/publish/Container.vue @@ -124,6 +124,9 @@ export default { setValues(state, values) { state.values = values; }, + setExtraValues(state, values) { + state.extraValues = values; + }, setHiddenField(state, field) { state.hiddenFields[field.dottedKey] = { hidden: field.hidden, @@ -211,6 +214,9 @@ export default { context.commit('setValues', payload); vm.emitUpdatedEvent(context.state.values); }, + setExtraValues(context, payload) { + context.commit('setExtraValues', payload); + }, setMeta(context, payload) { context.commit('setMeta', payload); } @@ -276,6 +282,14 @@ export default { } }, + extraValues: { + deep: true, + handler(after, before) { + if (_.isEqual(before, after)) return; + this.$store.commit(`publish/${this.name}/setExtraValues`, after); + } + }, + meta: { deep: true, handler(after, before) { diff --git a/resources/views/entries/create.blade.php b/resources/views/entries/create.blade.php index 580ea377a2..8f7392289e 100644 --- a/resources/views/entries/create.blade.php +++ b/resources/views/entries/create.blade.php @@ -10,6 +10,7 @@ :collection-has-routes="{{ Statamic\Support\Str::bool($collectionHasRoutes) }}" :fieldset="{{ json_encode($blueprint) }}" :values="{{ json_encode($values) }}" + :extra-values="{{ json_encode($extraValues) }}" :meta="{{ json_encode($meta) }}" :published="{{ json_encode($published) }}" :localizations="{{ json_encode($localizations) }}" diff --git a/resources/views/entries/edit.blade.php b/resources/views/entries/edit.blade.php index ee8cae9e06..29b74f3ae4 100644 --- a/resources/views/entries/edit.blade.php +++ b/resources/views/entries/edit.blade.php @@ -15,6 +15,7 @@ initial-reference="{{ $reference }}" :initial-fieldset="{{ json_encode($blueprint) }}" :initial-values="{{ json_encode($values) }}" + :initial-extra-values="{{ json_encode($extraValues) }}" :initial-localized-fields="{{ json_encode($localizedFields) }}" :initial-meta="{{ json_encode($meta) }}" initial-permalink="{{ $permalink }}" diff --git a/src/Fieldtypes/Entries.php b/src/Fieldtypes/Entries.php index cae2ffc025..b51f0706ce 100644 --- a/src/Fieldtypes/Entries.php +++ b/src/Fieldtypes/Entries.php @@ -46,6 +46,7 @@ class Entries extends Relationship 'initialReference' => 'reference', 'initialFieldset' => 'blueprint', 'initialValues' => 'values', + 'initialExtraValues' => 'extraValues', 'initialLocalizedFields' => 'localizedFields', 'initialMeta' => 'meta', 'initialPermalink' => 'permalink', diff --git a/src/Http/Controllers/CP/Collections/EntriesController.php b/src/Http/Controllers/CP/Collections/EntriesController.php index 0b412664d1..08921a71e1 100644 --- a/src/Http/Controllers/CP/Collections/EntriesController.php +++ b/src/Http/Controllers/CP/Collections/EntriesController.php @@ -101,7 +101,7 @@ public function edit(Request $request, $collection, $entry) $blueprint->ensureFieldHasConfig('author', ['visibility' => 'read_only']); } - [$values, $meta] = $this->extractFromFields($entry, $blueprint); + [$values, $meta, $extraValues] = $this->extractFromFields($entry, $blueprint); if ($hasOrigin = $entry->hasOrigin()) { [$originValues, $originMeta] = $this->extractFromFields($entry->origin(), $blueprint); @@ -121,6 +121,7 @@ public function edit(Request $request, $collection, $entry) 'editBlueprint' => cp_route('collections.blueprints.edit', [$collection, $blueprint]), ], 'values' => array_merge($values, ['id' => $entry->id()]), + 'extraValues' => $extraValues, 'meta' => $meta, 'collection' => $collection->handle(), 'collectionHasRoutes' => ! is_null($collection->route($entry->locale())), @@ -270,11 +271,12 @@ public function update(Request $request, $collection, $entry) $saved = $entry->updateLastModified(User::current())->save(); } - [$values] = $this->extractFromFields($entry, $blueprint); + [$values, $meta, $extraValues] = $this->extractFromFields($entry, $blueprint); return [ 'data' => array_merge((new EntryResource($entry->fresh()))->resolve()['data'], [ 'values' => $values, + 'extraValues' => $extraValues, ]), 'saved' => $saved, ]; @@ -321,6 +323,9 @@ public function create(Request $request, $collection, $site) 'save' => cp_route('collections.entries.store', [$collection->handle(), $site->handle()]), ], 'values' => $values->all(), + 'extraValues' => [ + 'depth' => 1, + ], 'meta' => $fields->meta(), 'collection' => $collection->handle(), 'collectionCreateLabel' => $collection->createLabel(), diff --git a/src/Http/Controllers/CP/Collections/ExtractsFromEntryFields.php b/src/Http/Controllers/CP/Collections/ExtractsFromEntryFields.php index 114b7eaecf..e196ada88a 100644 --- a/src/Http/Controllers/CP/Collections/ExtractsFromEntryFields.php +++ b/src/Http/Controllers/CP/Collections/ExtractsFromEntryFields.php @@ -41,6 +41,10 @@ protected function extractFromFields($entry, $blueprint) 'published' => $entry->published(), ]); - return [$values->all(), $fields->meta()]; + $extraValues = [ + 'depth' => $entry->page()?->depth(), + ]; + + return [$values->all(), $fields->meta(), $extraValues]; } } From 44c8bab0580cd1c67ddb9c3baf3741024823843a Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Wed, 6 Nov 2024 17:28:45 -0500 Subject: [PATCH 08/23] changelog --- CHANGELOG.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4eabf681ff..4ee1bbd65f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Release Notes +## 5.37.0 (2024-11-06) + +### What's new +- Improved fieldtype search using keywords [#11053](https://github.com/statamic/cms/issues/11053) by @jasonvarga +- Offer to enable Pro during make user command [#11071](https://github.com/statamic/cms/issues/11071) by @jasonvarga +- Add `--clear` option for `starter-kit:export` [#11079](https://github.com/statamic/cms/issues/11079) by @jesseleite +- Extra values for entry field conditions, including depth [#11080](https://github.com/statamic/cms/issues/11080) by @jasonvarga +- Add a config for specifying the default layout [#11025](https://github.com/statamic/cms/issues/11025) by @ryanmitchell + +### What's fixed +- Integer fields should render with `type="number"` [#11065](https://github.com/statamic/cms/issues/11065) by @duncanmcclean +- Update addon `.gitignore` stub [#11068](https://github.com/statamic/cms/issues/11068) by @duncanmcclean +- Adjust legacy ignition classes [#11073](https://github.com/statamic/cms/issues/11073) by @jasonvarga +- Fix Ignition Runnable Error Solutions [#11072](https://github.com/statamic/cms/issues/11072) by @jasonvarga +- Fix typeahead relationship input corrupting data [#11059](https://github.com/statamic/cms/issues/11059) by @daun +- Files Fieldtype: Don't truncate existing filename [#11055](https://github.com/statamic/cms/issues/11055) by @duncanmcclean +- Fix addon events dispatched twice if registered manually [#11049](https://github.com/statamic/cms/issues/11049) by @morhi +- Fix query parameters in external script URLs being wrongly encoded [#11052](https://github.com/statamic/cms/issues/11052) by @duncanmcclean +- Fix inline Bard with leading line break [#11038](https://github.com/statamic/cms/issues/11038) by @jacksleight +- Update Translations and fill in blanks with Google Translate [#11050](https://github.com/statamic/cms/issues/11050) by @jasonvarga + + + ## 5.36.0 (2024-10-31) ### What's new From 90e84886fe024317d42df720c166ecdb7cc52c96 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Thu, 7 Nov 2024 14:57:11 +0000 Subject: [PATCH 09/23] [5.x] Use layout config in errors too (#11083) --- src/Exceptions/Concerns/RendersHttpExceptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Exceptions/Concerns/RendersHttpExceptions.php b/src/Exceptions/Concerns/RendersHttpExceptions.php index aa4528b5d3..e6489261db 100644 --- a/src/Exceptions/Concerns/RendersHttpExceptions.php +++ b/src/Exceptions/Concerns/RendersHttpExceptions.php @@ -48,7 +48,7 @@ protected function layout() $layouts = collect([ 'errors.layout', 'layouts.layout', - 'layout', + config('statamic.system.layout', 'layout'), 'statamic::blank', ]); From 97bdb437a38bddf461f2f4b22306dbbcb67f8262 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Thu, 7 Nov 2024 10:31:27 -0500 Subject: [PATCH 10/23] [5.x] Render HTML for dictionary fields in listings (#11088) --- resources/js/bootstrap/fieldtypes.js | 2 ++ .../fieldtypes/DictionaryIndexFieldtype.vue | 19 +++++++++++++++++++ src/Fieldtypes/Dictionary.php | 1 - 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 resources/js/components/fieldtypes/DictionaryIndexFieldtype.vue diff --git a/resources/js/bootstrap/fieldtypes.js b/resources/js/bootstrap/fieldtypes.js index fb18e8689c..c758179a0a 100644 --- a/resources/js/bootstrap/fieldtypes.js +++ b/resources/js/bootstrap/fieldtypes.js @@ -25,6 +25,7 @@ import TitleFormats from '../components/collections/TitleFormats.vue'; import ColorFieldtype from '../components/fieldtypes/ColorFieldtype.vue'; import DateFieldtype from '../components/fieldtypes/DateFieldtype.vue'; import DictionaryFieldtype from "../components/fieldtypes/DictionaryFieldtype.vue"; +import DictionaryIndexFieldtype from "../components/fieldtypes/DictionaryIndexFieldtype.vue"; import DictionaryFields from "../components/fieldtypes/DictionaryFields.vue"; import FieldDisplayFieldtype from '../components/fieldtypes/FieldDisplayFieldtype.vue'; import FieldsFieldtype from '../components/fieldtypes/grid/FieldsFieldtype.vue'; @@ -89,6 +90,7 @@ Vue.component('collection_title_formats-fieldtype', TitleFormats); Vue.component('color-fieldtype', ColorFieldtype); Vue.component('date-fieldtype', DateFieldtype); Vue.component('dictionary-fieldtype', DictionaryFieldtype); +Vue.component('dictionary-fieldtype-index', DictionaryIndexFieldtype); Vue.component('dictionary_fields-fieldtype', DictionaryFields); Vue.component('field_display-fieldtype', FieldDisplayFieldtype); Vue.component('fields-fieldtype', FieldsFieldtype); diff --git a/resources/js/components/fieldtypes/DictionaryIndexFieldtype.vue b/resources/js/components/fieldtypes/DictionaryIndexFieldtype.vue new file mode 100644 index 0000000000..afc7fddb84 --- /dev/null +++ b/resources/js/components/fieldtypes/DictionaryIndexFieldtype.vue @@ -0,0 +1,19 @@ + + + diff --git a/src/Fieldtypes/Dictionary.php b/src/Fieldtypes/Dictionary.php index c74cf9b564..a3659a84f4 100644 --- a/src/Fieldtypes/Dictionary.php +++ b/src/Fieldtypes/Dictionary.php @@ -15,7 +15,6 @@ class Dictionary extends Fieldtype { protected $categories = ['controls', 'relationship']; protected $selectableInForms = true; - protected $indexComponent = 'tags'; protected function configFieldItems(): array { From 0a2ec2578f8cb6df2825eeabe080aa7c040e2d28 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Thu, 7 Nov 2024 19:16:05 +0000 Subject: [PATCH 11/23] [5.x] Fix error after deleting role when storing users in the database (#11069) --- src/Auth/Eloquent/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Auth/Eloquent/User.php b/src/Auth/Eloquent/User.php index db647f16b6..50c6d28cff 100644 --- a/src/Auth/Eloquent/User.php +++ b/src/Auth/Eloquent/User.php @@ -105,7 +105,7 @@ public function explicitRoles($roles = null) return $this->roles = $this->roles ?? (new Roles($this))->all()->map(function ($row) { return Role::find($row->role_id); - })->keyBy->handle(); + })->filter()->keyBy->handle(); } protected function saveRoles() From 31fe5622593cb25f7c6fb61f9911a95604aeac2c Mon Sep 17 00:00:00 2001 From: Emmanuel Beauchamps Date: Thu, 7 Nov 2024 22:11:17 +0100 Subject: [PATCH 12/23] [5.x] French translations (#11093) --- resources/lang/fr.json | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/lang/fr.json b/resources/lang/fr.json index be157334c5..eaf2eb0ca8 100644 --- a/resources/lang/fr.json +++ b/resources/lang/fr.json @@ -401,6 +401,7 @@ "Enable Pro Mode": "Activer le mode Pro", "Enable Publish Dates": "Activer les dates de publication", "Enable Revisions": "Activer les révisions", + "Enable Statamic Pro?": "Activer Statamic Pro ?", "Encryption": "Chiffrement", "Enter any internal or external URL.": "Renseigner n'importe quel lien URL interne ou externe.", "Enter URL": "Renseigner l'URL", From c6727f35eb21fb947a04c83408e2e220b690d139 Mon Sep 17 00:00:00 2001 From: Aaron Bushnell Date: Thu, 7 Nov 2024 17:11:41 -0500 Subject: [PATCH 13/23] [5.x] Create edit/{id} route for control panel access (#11092) Co-authored-by: Jason Varga --- routes/cp.php | 3 ++ .../CP/Collections/EditRedirectController.php | 20 ++++++++++ tests/CP/EditRedirectControllerTest.php | 39 +++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 src/Http/Controllers/CP/Collections/EditRedirectController.php create mode 100644 tests/CP/EditRedirectControllerTest.php diff --git a/routes/cp.php b/routes/cp.php index 3048c10f64..19f8743826 100644 --- a/routes/cp.php +++ b/routes/cp.php @@ -28,6 +28,7 @@ use Statamic\Http\Controllers\CP\Collections\CollectionBlueprintsController; use Statamic\Http\Controllers\CP\Collections\CollectionsController; use Statamic\Http\Controllers\CP\Collections\CollectionTreeController; +use Statamic\Http\Controllers\CP\Collections\EditRedirectController; use Statamic\Http\Controllers\CP\Collections\EntriesController; use Statamic\Http\Controllers\CP\Collections\EntryActionController; use Statamic\Http\Controllers\CP\Collections\EntryPreviewController; @@ -361,5 +362,7 @@ Route::view('/playground', 'statamic::playground')->name('playground'); + Route::get('edit/{id}', EditRedirectController::class); + Route::get('{segments}', [CpController::class, 'pageNotFound'])->where('segments', '.*')->name('404'); }); diff --git a/src/Http/Controllers/CP/Collections/EditRedirectController.php b/src/Http/Controllers/CP/Collections/EditRedirectController.php new file mode 100644 index 0000000000..5e040ff5bf --- /dev/null +++ b/src/Http/Controllers/CP/Collections/EditRedirectController.php @@ -0,0 +1,20 @@ +id)) { + return redirect($data->editUrl()); + } + + throw new NotFoundHttpException; + } +} diff --git a/tests/CP/EditRedirectControllerTest.php b/tests/CP/EditRedirectControllerTest.php new file mode 100644 index 0000000000..f71b3a6d00 --- /dev/null +++ b/tests/CP/EditRedirectControllerTest.php @@ -0,0 +1,39 @@ +shouldReceive('editUrl')->once()->andReturn($targetUrl = '/somewhere'); + Data::shouldReceive('find')->with('123')->once()->andReturn($item); + + $this + ->actingAs(tap(User::make()->makeSuper())->save()) + ->get('/cp/edit/123') + ->assertRedirect($targetUrl); + } + + #[Test] + public function it_404s_if_id_doesnt_exist() + { + Data::shouldReceive('find')->with('123')->once()->andReturnNull(); + + $this + ->actingAs(tap(User::make()->makeSuper())->save()) + ->get('/cp/edit/123') + ->assertNotFound(); + } +} From 1d78ccfd9592f8c19633e8eb22403550ccbaa258 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Fri, 8 Nov 2024 14:47:38 +0000 Subject: [PATCH 14/23] [5.x] Add `fullyQualifiedHandle` method to `Blueprint` (#11096) --- src/Fields/Blueprint.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Fields/Blueprint.php b/src/Fields/Blueprint.php index 2717299a08..57dd57e906 100644 --- a/src/Fields/Blueprint.php +++ b/src/Fields/Blueprint.php @@ -71,6 +71,19 @@ public function namespace(): ?string return $this->namespace; } + public function fullyQualifiedHandle(): string + { + $handle = $this->handle(); + + if ($this->namespace()) { + $handle = $this->isNamespaced() + ? $this->namespace().'::'.$handle + : $this->namespace().'.'.$handle; + } + + return $handle; + } + public function setOrder($order) { if (! is_null($order)) { From 09a2c4b072f31ff80be15c6c1d67a555e038e100 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Mon, 11 Nov 2024 14:31:09 +0000 Subject: [PATCH 15/23] [5.x] Add "Container" option to Asset Folders fieldtype (#11099) --- .../fieldtypes/AssetFolderFieldtype.vue | 6 ++-- resources/lang/en/fieldtypes.php | 1 + src/Fieldtypes/AssetFolder.php | 34 +++++++++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/resources/js/components/fieldtypes/AssetFolderFieldtype.vue b/resources/js/components/fieldtypes/AssetFolderFieldtype.vue index ff0eae36f2..03c71b017b 100644 --- a/resources/js/components/fieldtypes/AssetFolderFieldtype.vue +++ b/resources/js/components/fieldtypes/AssetFolderFieldtype.vue @@ -1,13 +1,11 @@ @@ -25,7 +25,8 @@ export default { props: { url: String, - blueprints: Array + blueprints: Array, + text: { type: String, default: () => __('Create Term') }, }, methods: { diff --git a/resources/views/taxonomies/show.blade.php b/resources/views/taxonomies/show.blade.php index 3aff3310d8..85649b5ab9 100644 --- a/resources/views/taxonomies/show.blade.php +++ b/resources/views/taxonomies/show.blade.php @@ -36,6 +36,7 @@ @if($canCreate) @endif diff --git a/resources/views/terms/create.blade.php b/resources/views/terms/create.blade.php index e3cf15a937..4e2d9d5796 100644 --- a/resources/views/terms/create.blade.php +++ b/resources/views/terms/create.blade.php @@ -1,11 +1,12 @@ @extends('statamic::layout') -@section('title', $breadcrumbs->title('Create Term')) +@section('title', $breadcrumbs->title($taxonomyCreateLabel)) @section('wrapper_class', 'max-w-3xl') @section('content') __('Create Term'), + 'title' => $taxonomy->createLabel(), 'actions' => [ 'save' => cp_route('taxonomies.terms.store', [$taxonomy->handle(), $site->handle()]), ], 'values' => $values, 'meta' => $fields->meta(), 'taxonomy' => $taxonomy->handle(), + 'taxonomyCreateLabel' => $taxonomy->createLabel(), 'blueprint' => $blueprint->toPublishArray(), 'published' => $taxonomy->defaultPublishState(), 'locale' => $site->handle(), diff --git a/src/Taxonomies/Taxonomy.php b/src/Taxonomies/Taxonomy.php index 2e5010a9c9..b2bfd4e76e 100644 --- a/src/Taxonomies/Taxonomy.php +++ b/src/Taxonomies/Taxonomy.php @@ -441,6 +441,19 @@ public function layout($layout = null) ->args(func_get_args()); } + public function createLabel() + { + $key = "messages.{$this->handle()}_taxonomy_create_term"; + + $translation = __($key); + + if ($translation === $key) { + return __('Create Term'); + } + + return $translation; + } + public function searchIndex($index = null) { return $this diff --git a/tests/Data/Taxonomies/TaxonomyTest.php b/tests/Data/Taxonomies/TaxonomyTest.php index 7c76a3c91c..6d502da262 100644 --- a/tests/Data/Taxonomies/TaxonomyTest.php +++ b/tests/Data/Taxonomies/TaxonomyTest.php @@ -429,6 +429,13 @@ public function it_gets_and_sets_the_term_template() $this->assertEquals('foo', $taxonomy->termTemplate()); } + #[Test] + public function it_gets_and_sets_the_create_label() + { + $taxonomy = (new Taxonomy)->handle('tags'); + $this->assertEquals('Create Term', $taxonomy->createLabel()); + } + #[Test] public function it_cannot_view_taxonomies_from_sites_that_the_user_is_not_authorized_to_see() { From f13a997d291ff51bc83c6cb9bf9ffd2d264ea661 Mon Sep 17 00:00:00 2001 From: Emmanuel Beauchamps Date: Mon, 11 Nov 2024 15:38:14 +0100 Subject: [PATCH 19/23] [5.x] French translations (#11100) Co-authored-by: Jason Varga --- resources/lang/fr.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/fr.json b/resources/lang/fr.json index eaf2eb0ca8..66f04ff092 100644 --- a/resources/lang/fr.json +++ b/resources/lang/fr.json @@ -845,7 +845,7 @@ "Search...": "Recherche...", "Searchable": "Consultable", "Searchables": "Consultables", - "Searching in:": "Recherche dans", + "Searching in:": "Recherche dans:", "Select": "Choisir", "Select Across Sites": "Choisir au sein des sites", "Select asset container": "Choisir un conteneur de ressources", From d479f050a95ec7304096b2891425d2a013b72622 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Mon, 11 Nov 2024 18:01:21 +0000 Subject: [PATCH 20/23] [5.x] Hide "Localizable" button on non-localizable blueprints (#11107) --- resources/js/components/blueprints/Builder.vue | 4 +++- resources/js/components/blueprints/TabContent.vue | 4 ++++ resources/js/components/blueprints/Tabs.vue | 4 ++++ resources/views/forms/blueprints/edit.blade.php | 1 + resources/views/usergroups/blueprints/edit.blade.php | 1 + resources/views/users/blueprints/edit.blade.php | 1 + 6 files changed, 14 insertions(+), 1 deletion(-) diff --git a/resources/js/components/blueprints/Builder.vue b/resources/js/components/blueprints/Builder.vue index fb556c0b1f..314a291858 100644 --- a/resources/js/components/blueprints/Builder.vue +++ b/resources/js/components/blueprints/Builder.vue @@ -43,6 +43,7 @@ :single-tab="!useTabs" :initial-tabs="tabs" :errors="errors.tabs" + :can-define-localizable="canDefineLocalizable" @updated="tabsUpdated" /> @@ -53,10 +54,11 @@