Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New storage core component #6867

Merged
merged 2 commits into from
Dec 17, 2024
Merged

New storage core component #6867

merged 2 commits into from
Dec 17, 2024

Conversation

bastianallgeier
Copy link
Member

@bastianallgeier bastianallgeier commented Dec 16, 2024

Description

The new storage component can define the default storage instance for any model (site, page, user, file)

Changelog

Enhancements

  • New App::storage(ModelWithContent $model) method
  • New storage component, which can be overwritten in plugins or the app instance setup.
  • The storage component is now used in all Models to create the default storage instance

Breaking changes

None

Docs

A new default storage component can be defined like this:

use Kirby\Cms\App;
use Kirby\Cms\ModelWithContent;
use Kirby\Content\PlainTextStorage;

class MyCustomStorageClass extends PlainTextStorage
{

}

// on app initialisation
$kirby = new App([
  'components' => [
    'storage' => function (App $kirby, ModelWithContent $model) {
        return MyCustomStorageClass($model);
    ]
  ]  
]);

// in a plugin
App::plugin('my/storage', [
  'components' => [
    'storage' => function (App $kirby, ModelWithContent $model) {
        return MyCustomStorageClass($model);
    ]
  ]  
]);

Ready?

  • In-code documentation (wherever needed)
  • Unit tests for fixed bug/feature
  • Tests and CI checks all pass

For review team

  • Add changes & docs to release notes draft in Notion

@bastianallgeier bastianallgeier merged commit 0c7d8ef into v5/develop Dec 17, 2024
12 checks passed
@bastianallgeier bastianallgeier deleted the v5/storage-component branch December 17, 2024 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants