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