‪TYPO3CMS  10.4
TableWizard.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 
25 
31 {
37  public function ‪render()
38  {
39  $options = $this->data['renderData']['fieldControlOptions'];
40  $parameterArray = $this->data['parameterArray'];
41  $itemName = $parameterArray['itemFormElName'];
42  $row = $this->data['databaseRow'];
43 
45  return [];
46  }
47 
48  // Handle options and fallback
49  $title = $options['title'] ?? 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.tableWizard';
50  $xmlOutput = isset($options['xmlOutput']) ? (int)$options['xmlOutput'] : 0;
51  $numNewRows = isset($options['numNewRows']) ? (int)$options['numNewRows'] : 5;
52 
53  $prefixOfFormElName = 'data[' . $this->data['tableName'] . '][' . $this->data['databaseRow']['uid'] . '][' . $this->data['fieldName'] . ']';
54  $flexFormPath = '';
55  if (GeneralUtility::isFirstPartOfStr($itemName, $prefixOfFormElName)) {
56  $flexFormPath = str_replace('][', '/', substr($itemName, strlen($prefixOfFormElName) + 1, -1));
57  }
58 
59  $urlParameters = [
60  'P' => [
61  'params' => [
62  'xmlOutput' => $xmlOutput,
63  'numNewRows' => $numNewRows,
64  ],
65  'table' => $this->data['tableName'],
66  'field' => $this->data['fieldName'],
67  'uid' => $this->data['databaseRow']['uid'],
68  'flexFormPath' => $flexFormPath,
69  'returnUrl' => $this->data['returnUrl'],
70  ],
71  ];
72 
73  $id = ‪StringUtility::getUniqueId('t3js-formengine-fieldcontrol-');
74 
76  $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
77  return [
78  'iconIdentifier' => 'content-table',
79  'title' => $title,
80  'linkAttributes' => [
81  'id' => htmlspecialchars($id),
82  'href' => (string)$uriBuilder->buildUriFromRoute('wizard_table', $urlParameters),
83  ],
84  'requireJsModules' => [
85  ['TYPO3/CMS/Backend/FormEngine/FieldControl/TableWizard' => 'function(FieldControl) {new FieldControl(' . GeneralUtility::quoteJSvalue('#' . $id) . ');}'],
86  ],
87  ];
88  }
89 }
‪TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger
‪static bool canBeInterpretedAsInteger($var)
Definition: MathUtility.php:74
‪TYPO3\CMS\Backend\Form\FieldControl
Definition: AddRecord.php:18
‪TYPO3\CMS\Backend\Routing\UriBuilder
Definition: UriBuilder.php:38
‪TYPO3\CMS\Core\Utility\StringUtility\getUniqueId
‪static string getUniqueId($prefix='')
Definition: StringUtility.php:92
‪TYPO3\CMS\Core\Utility\MathUtility
Definition: MathUtility.php:22
‪TYPO3\CMS\Backend\Form\AbstractNode
Definition: AbstractNode.php:29
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Core\Utility\StringUtility
Definition: StringUtility.php:22
‪TYPO3\CMS\Backend\Form\FieldControl\TableWizard
Definition: TableWizard.php:31
‪TYPO3\CMS\Backend\Form\FieldControl\TableWizard\render
‪array render()
Definition: TableWizard.php:37