‪TYPO3CMS  ‪main
ModifyInlineElementControlsEvent.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
24 {
25  public function ‪__construct(
26  private array $controls,
27  private readonly array $data,
28  private readonly array ‪$record,
29  ) {}
30 
34  public function ‪getControls(): array
35  {
36  return $this->controls;
37  }
38 
42  public function ‪setControls(array $controls): void
43  {
44  $this->controls = $controls;
45  }
46 
50  public function ‪getControl(string ‪$identifier): string
51  {
52  return $this->controls[‪$identifier] ?? '';
53  }
54 
59  public function ‪setControl(string ‪$identifier, string $markup): void
60  {
61  $this->controls[‪$identifier] = $markup;
62  }
63 
67  public function ‪hasControl(string ‪$identifier): bool
68  {
69  return isset($this->controls[‪$identifier]);
70  }
71 
77  public function ‪removeControl(string ‪$identifier): bool
78  {
79  if (!$this->‪hasControl($identifier)) {
80  return false;
81  }
82 
83  unset($this->controls[‪$identifier]);
84  return true;
85  }
86 
90  public function ‪getElementData(): array
91  {
92  return $this->data;
93  }
94 
98  public function ‪getRecord(): array
99  {
100  return ‪$this->record;
101  }
102 
106  public function ‪getParentUid(): string
107  {
108  return (string)($this->data['inlineParentUid'] ?? '');
109  }
110 
114  public function ‪getForeignTable(): string
115  {
116  return (string)($this->‪getFieldConfiguration()['foreign_table'] ?? '');
117  }
118 
122  public function ‪getFieldConfiguration(): array
123  {
124  return (array)($this->data['inlineParentConfig'] ?? []);
125  }
126 
130  public function ‪isVirtual(): bool
131  {
132  return (bool)($this->data['isInlineDefaultLanguageRecordInLocalizedParentContext'] ?? false);
133  }
134 }
‪TYPO3\CMS\Backend\Form\Event
Definition: CustomFileControlsEvent.php:18
‪TYPO3\CMS\Backend\Form\Event\ModifyInlineElementControlsEvent\getRecord
‪getRecord()
Definition: ModifyInlineElementControlsEvent.php:98
‪TYPO3\CMS\Backend\Form\Event\ModifyInlineElementControlsEvent\getParentUid
‪getParentUid()
Definition: ModifyInlineElementControlsEvent.php:106
‪TYPO3\CMS\Backend\Form\Event\ModifyInlineElementControlsEvent\hasControl
‪hasControl(string $identifier)
Definition: ModifyInlineElementControlsEvent.php:67
‪TYPO3\CMS\Backend\Form\Event\ModifyInlineElementControlsEvent\isVirtual
‪isVirtual()
Definition: ModifyInlineElementControlsEvent.php:130
‪TYPO3\CMS\Backend\Form\Event\ModifyInlineElementControlsEvent\__construct
‪__construct(private array $controls, private readonly array $data, private readonly array $record,)
Definition: ModifyInlineElementControlsEvent.php:25
‪TYPO3\CMS\Backend\Form\Event\ModifyInlineElementControlsEvent
Definition: ModifyInlineElementControlsEvent.php:24
‪TYPO3\CMS\Backend\Form\Event\ModifyInlineElementControlsEvent\getControls
‪getControls()
Definition: ModifyInlineElementControlsEvent.php:34
‪TYPO3\CMS\Backend\Form\Event\ModifyInlineElementControlsEvent\getControl
‪getControl(string $identifier)
Definition: ModifyInlineElementControlsEvent.php:50
‪TYPO3\CMS\Webhooks\Message\$record
‪identifier readonly int readonly array $record
Definition: PageModificationMessage.php:36
‪TYPO3\CMS\Backend\Form\Event\ModifyInlineElementControlsEvent\getForeignTable
‪getForeignTable()
Definition: ModifyInlineElementControlsEvent.php:114
‪TYPO3\CMS\Backend\Form\Event\ModifyInlineElementControlsEvent\getElementData
‪getElementData()
Definition: ModifyInlineElementControlsEvent.php:90
‪TYPO3\CMS\Backend\Form\Event\ModifyInlineElementControlsEvent\removeControl
‪bool removeControl(string $identifier)
Definition: ModifyInlineElementControlsEvent.php:77
‪TYPO3\CMS\Backend\Form\Event\ModifyInlineElementControlsEvent\setControls
‪setControls(array $controls)
Definition: ModifyInlineElementControlsEvent.php:42
‪TYPO3\CMS\Backend\Form\Event\ModifyInlineElementControlsEvent\setControl
‪setControl(string $identifier, string $markup)
Definition: ModifyInlineElementControlsEvent.php:59
‪TYPO3\CMS\Backend\Form\Event\ModifyInlineElementControlsEvent\getFieldConfiguration
‪getFieldConfiguration()
Definition: ModifyInlineElementControlsEvent.php:122
‪TYPO3\CMS\Webhooks\Message\$identifier
‪identifier readonly string $identifier
Definition: FileAddedMessage.php:37