Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"statamic/cms": "^3.0 || ^4.0 || ^5.0"
"statamic/cms": "^6.0"
},
"extra": {
"statamic": {
Expand Down
30 changes: 16 additions & 14 deletions resources/js/fieldtype.js
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
}
},
},
);
});
6 changes: 3 additions & 3 deletions src/Fieldtypes/ExtendedSectionFieldtype.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
7 changes: 7 additions & 0 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,11 @@ class ServiceProvider extends AddonServiceProvider
protected $fieldtypes = [
ExtendedSectionFieldtype::class,
];

public function boot()
{
parent::boot();

$this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'statamic-charfield');
}
}