‪TYPO3CMS  ‪main
UpdateValueOnFieldChange.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 class ‪UpdateValueOnFieldChange implements OnFieldChangeInterface
25 {
26  protected string ‪$tableName;
27  protected string ‪$identifier;
28  protected string ‪$fieldName;
29  protected string ‪$elementName;
30 
31  public function ‪__construct(string ‪$tableName, string ‪$identifier, string ‪$fieldName, string ‪$elementName)
32  {
33  $this->tableName = ‪$tableName;
34  $this->identifier = ‪$identifier;
35  $this->fieldName = ‪$fieldName;
36  $this->elementName = ‪$elementName;
37  }
38 
39  public function ‪withElementName(string ‪$elementName): self
40  {
41  if ($this->elementName === ‪$elementName) {
42  return $this;
43  }
44  $target = clone $this;
45  $target->elementName = ‪$elementName;
46  return $target;
47  }
48 
49  public function ‪toArray(): array
50  {
51  return [
52  'name' => 'typo3-backend-form-update-value',
53  'data' => [
54  'tableName' => ‪$this->tableName,
55  'identifier' => ‪$this->identifier,
56  'fieldName' => ‪$this->fieldName,
57  'elementName' => ‪$this->elementName,
58  ],
59  ];
60  }
61 }
‪TYPO3\CMS\Backend\Form\Behavior\UpdateValueOnFieldChange\$tableName
‪string $tableName
Definition: UpdateValueOnFieldChange.php:26
‪TYPO3\CMS\Backend\Form\Behavior
Definition: OnFieldChangeInterface.php:18
‪TYPO3\CMS\Backend\Form\Behavior\UpdateValueOnFieldChange
Definition: UpdateValueOnFieldChange.php:25
‪TYPO3\CMS\Backend\Form\Behavior\UpdateValueOnFieldChange\withElementName
‪withElementName(string $elementName)
Definition: UpdateValueOnFieldChange.php:39
‪TYPO3\CMS\Backend\Form\Behavior\UpdateValueOnFieldChange\$elementName
‪string $elementName
Definition: UpdateValueOnFieldChange.php:29
‪TYPO3\CMS\Backend\Form\Behavior\UpdateValueOnFieldChange\$identifier
‪string $identifier
Definition: UpdateValueOnFieldChange.php:27
‪TYPO3\CMS\Backend\Form\Behavior\UpdateValueOnFieldChange\$fieldName
‪string $fieldName
Definition: UpdateValueOnFieldChange.php:28
‪TYPO3\CMS\Backend\Form\Behavior\UpdateValueOnFieldChange\__construct
‪__construct(string $tableName, string $identifier, string $fieldName, string $elementName)
Definition: UpdateValueOnFieldChange.php:31
‪TYPO3\CMS\Backend\Form\Behavior\UpdateValueOnFieldChange\toArray
‪toArray()
Definition: UpdateValueOnFieldChange.php:49