diff --git a/composer.json b/composer.json index 9f8b947..75f7daf 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "statamic/cms": "^3.0 || ^4.0 || ^5.0" + "statamic/cms": "^6.0" }, "extra": { "statamic": { diff --git a/resources/js/fieldtype.js b/resources/js/fieldtype.js index 9aa4053..0244338 100644 --- a/resources/js/fieldtype.js +++ b/resources/js/fieldtype.js @@ -1,28 +1,30 @@ -/** global: Vue */ +Statamic.booting(() => { + Statamic.$components.register('extended_section-fieldtype', { + props: ['data', 'config', 'name'], -Statamic.$components.register('extended_section-fieldtype', { - props: ['data', 'config', 'name'], - - mounted: function () { - // find container parent - var container = this.$el.parentNode; - while (!container.classList || !container.classList.contains('form-group')) { + mounted: function() { + // find container parent + var container = this.$el.parentNode; + while (!container.classList || + !container.classList.contains('form-group')) { container = container.parentNode; if (!container) { - break; + break; } - } + } - if (container) { + if (container) { // we add the original section class to inherit all the styles container.classList.add('section-fieldtype'); // and add our color var background = this.config.background; if (background) { - container.classList.add('color-' + background); + container.classList.add('color-' + background); } - } - } + } + }, + }, + ); }); diff --git a/src/Fieldtypes/ExtendedSectionFieldtype.php b/src/Fieldtypes/ExtendedSectionFieldtype.php index 8960baa..1f088d0 100644 --- a/src/Fieldtypes/ExtendedSectionFieldtype.php +++ b/src/Fieldtypes/ExtendedSectionFieldtype.php @@ -2,11 +2,11 @@ namespace AppsWithLove\Statamic\ExtendedSection\Fieldtypes; -use Statamic\Fieldtypes\Section; +use Statamic\Fields\Fieldtype; -class ExtendedSectionFieldtype extends Section +class ExtendedSectionFieldtype extends Fieldtype { - protected $icon = 'section'; + protected $icon = 'fieldtype-section'; protected function configFieldItems(): array { diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index f1845c6..14f9581 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -18,4 +18,11 @@ class ServiceProvider extends AddonServiceProvider protected $fieldtypes = [ ExtendedSectionFieldtype::class, ]; + + public function boot() + { + parent::boot(); + + $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'statamic-charfield'); + } }