<?php
namespace App\Document\Areabrick;
use Pimcore\Model\Document\Editable;
use Pimcore\Model\Document\Editable\Area\Info;
use Pimcore\Extension\Document\Areabrick\EditableDialogBoxConfiguration;
use Pimcore\Extension\Document\Areabrick\EditableDialogBoxInterface;
use Pimcore\Translation\Translator;
class Iframe extends BaseAreabrick implements EditableDialogBoxInterface
{
public function __construct(Translator $translator)
{
$this->translator = $translator;
}
public function getName(): string
{
return $this->translator->trans('iFrame', [], 'admin');
}
public function getHtmlTagOpen(Info $info)
{
return '';
}
public function getHtmlTagClose(Info $info)
{
return '';
}
public function getDescription()
{
return 'A component for integrating an iFrame';
}
public function getEditableDialogBoxConfiguration(Editable $area, ?Info $info): EditableDialogBoxConfiguration
{
return (new EditableDialogBoxConfiguration())
->setItems([
'type' => 'tabpanel',
'items' => [
[
'type' => 'panel',
'title' => $this->translator->trans('Settings', [], 'admin'),
'items' => [
[
'type' => 'textarea',
'name' => 'iframe-url',
'label' => $this->translator->trans('iFrame URL?', [], 'admin'),
'placeholder' => 'https://'
],
[
'type' => 'numeric',
'name' => 'iframe-height',
'minValue' => 0,
'maxValue' => 9999,
'decimalPrecision' => 0,
'label' => $this->translator->trans('iFrame height?', [], 'admin'),
],
[
'type' => 'select',
'name' => 'iframe-locked',
'label' => $this->translator->trans('iFrame locked?', [], 'admin'),
'config' => [
'store' => [
['none', $this->translator->trans('Yes', [], 'admin'),],
[false, $this->translator->trans('No', [], 'admin'),],
],
'defaultValue' => false
]
],
[
'type' => 'select',
'name' => 'scrolling-enabled',
'label' => $this->translator->trans('Scrollbar enabled?', [], 'admin'),
'config' => [
'store' => [
['yes', $this->translator->trans('Yes', [], 'admin'),],
['no', $this->translator->trans('No', [], 'admin'),],
],
'defaultValue' => 'yes'
]
],
[
'type' => 'textarea',
'name' => 'iframe-title',
'label' => $this->translator->trans('iFrame Title?', [], 'admin'),
'placeholder' => 'iFrame Title',
],
[
'type' => 'textarea',
'name' => 'iframe-aria-label',
'label' => $this->translator->trans('iFrame Aria Label?', [], 'admin'),
'placeholder' => 'iFrame Aria Label',
],
]
],
]
])
->setReloadOnClose(true);
}
}