FIX: Replace embed field

This commit is contained in:
Tony Air 2022-07-02 18:14:50 +02:00
parent 8b840d16a5
commit b95de9a58f
2 changed files with 25 additions and 10 deletions

View File

@ -16,11 +16,12 @@
"silverstripe/cms": "^4",
"a2nt/silverstripe-elemental-basics": "*",
"silverstripe/widgets": "*",
"drmartingonzo/ss-tinymce-charcount": "*"
"drmartingonzo/ss-tinymce-charcount": "*",
"gorriecoe/silverstripe-embed": "*"
},
"autoload": {
"psr-4": {
"A2nt\\ElementalBasics\\": "src/"
"A2nt\\CMSNiceties\\": "src/"
}
}
}

View File

@ -3,37 +3,51 @@
namespace A2nt\CMSNiceties\Extensions;
use Sheadawson\Linkable\Forms\EmbeddedObjectField;
use gorriecoe\Embed\Extensions\Embeddable;
use SilverStripe\Forms\CheckboxField;
use SilverStripe\Forms\CompositeField;
use SilverStripe\Forms\LiteralField;
use SilverStripe\ORM\FieldType\DBHTMLText;
class EmbedObjectField extends EmbeddedObjectField
class EmbedObjectField extends Embeddable
{
/**
* List the allowed included embed types. If null all are allowed.
* @var array
*/
private static $allowed_embed_types = [
'video',
'photo'
];
/**
* Defines tab to insert the embed fields into.
* @var string
*/
private static $embed_tab = 'Main';
/**
* @param array $properties
* @return mixed|DBHTMLText
*/
public function FieldHolder($properties = [])
/*public function FieldHolder($properties = [])
{
$name = $this->getName();
$fields = [
CheckboxField::create(
$name . '[autoplay]',
_t(self::CLASS.'AUTOPLAY', 'Autoplay video?')
_t(self::class.'AUTOPLAY', 'Autoplay video?')
)->setValue($this->object->getField('Autoplay')),
CheckboxField::create(
$name . '[loop]',
_t(self::CLASS.'LOOP', 'Loop video?')
_t(self::class.'LOOP', 'Loop video?')
)->setValue($this->object->getField('Loop')),
CheckboxField::create(
$name.'[controls]',
_t(self::CLASS.'CONTROLS', 'Show player controls?')
_t(self::class.'CONTROLS', 'Show player controls?')
)->setValue($this->object->getField('Controls'))
];
@ -43,5 +57,5 @@ class EmbedObjectField extends EmbeddedObjectField
parent::FieldHolder($properties)
)
], $fields));
}
}*/
}