src/Document/Areabrick/Iframe.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Document\Areabrick;
  3. use Pimcore\Model\Document\Editable;
  4. use Pimcore\Model\Document\Editable\Area\Info;
  5. use Pimcore\Extension\Document\Areabrick\EditableDialogBoxConfiguration;
  6. use Pimcore\Extension\Document\Areabrick\EditableDialogBoxInterface;
  7. use Pimcore\Translation\Translator;
  8. class Iframe extends BaseAreabrick implements EditableDialogBoxInterface
  9. {
  10.     public function __construct(Translator $translator)
  11.     {
  12.         $this->translator = $translator;
  13.     }
  14.     public function getName(): string
  15.     {
  16.         return $this->translator->trans('iFrame', [], 'admin');
  17.     }
  18.     public function getHtmlTagOpen(Info $info)
  19.     {
  20.         return '';
  21.     }
  22.     public function getHtmlTagClose(Info $info)
  23.     {
  24.         return '';
  25.     }
  26.     public function getDescription()
  27.     {
  28.         return 'A component for integrating an iFrame';
  29.     }
  30.     public function getEditableDialogBoxConfiguration(Editable $area, ?Info $info): EditableDialogBoxConfiguration
  31.     {
  32.         return (new EditableDialogBoxConfiguration())
  33.             ->setItems([
  34.                 'type' => 'tabpanel',
  35.                 'items' => [
  36.                     [
  37.                         'type' => 'panel',
  38.                         'title' => $this->translator->trans('Settings', [], 'admin'),
  39.                         'items' => [
  40.                             [
  41.                                 'type' => 'textarea',
  42.                                 'name' => 'iframe-url',
  43.                                 'label' => $this->translator->trans('iFrame URL?', [], 'admin'),
  44.                                 'placeholder' => 'https://'
  45.                             ],
  46.                             [
  47.                                 'type' => 'numeric',
  48.                                 'name' => 'iframe-height',
  49.                                 'minValue' => 0,
  50.                                 'maxValue' => 9999,
  51.                                 'decimalPrecision' => 0,
  52.                                 'label' => $this->translator->trans('iFrame height?', [], 'admin'),
  53.                             ],
  54.                             [
  55.                                 'type' => 'select',
  56.                                 'name' => 'iframe-locked',
  57.                                 'label' => $this->translator->trans('iFrame locked?', [], 'admin'),
  58.                                 'config' => [
  59.                                     'store' => [
  60.                                         ['none', $this->translator->trans('Yes', [], 'admin'),],
  61.                                         [false, $this->translator->trans('No', [], 'admin'),],
  62.                                     ],
  63.                                     'defaultValue' => false
  64.                                 ]
  65.                             ],
  66.                             [
  67.                                 'type' => 'select',
  68.                                 'name' => 'scrolling-enabled',
  69.                                 'label' => $this->translator->trans('Scrollbar enabled?', [], 'admin'),
  70.                                 'config' => [
  71.                                     'store' => [
  72.                                         ['yes', $this->translator->trans('Yes', [], 'admin'),],
  73.                                         ['no', $this->translator->trans('No', [], 'admin'),],
  74.                                     ],
  75.                                     'defaultValue' => 'yes'
  76.                                 ]
  77.                             ],
  78.                             [
  79.                                 'type' => 'textarea',
  80.                                 'name' => 'iframe-title',
  81.                                 'label' => $this->translator->trans('iFrame Title?', [], 'admin'),
  82.                                 'placeholder' => 'iFrame Title',
  83.                             ],
  84.                             [
  85.                                 'type' => 'textarea',
  86.                                 'name' => 'iframe-aria-label',
  87.                                 'label' => $this->translator->trans('iFrame Aria Label?', [], 'admin'),
  88.                                 'placeholder' => 'iFrame Aria Label',
  89.                             ],
  90.                         ]
  91.                     ],
  92.                 ]
  93.             ])
  94.             ->setReloadOnClose(true);
  95.     }
  96. }