| Conditions | 2 |
| Paths | 2 |
| Total Lines | 104 |
| Code Lines | 96 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 56 | public function render() |
||
| 57 | { |
||
| 58 | $lang = $this->getLanguageService(); |
||
| 59 | $resultArray = $this->initializeResultArray(); |
||
| 60 | $this->init(); |
||
| 61 | |||
| 62 | $fieldInformationResult = $this->renderFieldInformation(); |
||
| 63 | $fieldInformationHtml = $fieldInformationResult['html']; |
||
| 64 | $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false); |
||
| 65 | |||
| 66 | $fieldWizardResult = $this->renderFieldWizard(); |
||
| 67 | $fieldWizardHtml = $fieldWizardResult['html']; |
||
| 68 | $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldWizardResult, false); |
||
| 69 | |||
| 70 | $json = (string)json_encode($this->rows, JSON_HEX_QUOT | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS); |
||
| 71 | $html = []; |
||
| 72 | $html[] = '<div class="formengine-field-item t3js-formengine-field-item">'; |
||
| 73 | $html[] = $fieldInformationHtml; |
||
| 74 | $html[] = '<div class="form-control-wrap">'; |
||
| 75 | $html[] = '<div class="form-wizards-wrap">'; |
||
| 76 | $html[] = '<div class="form-wizards-element">'; |
||
| 77 | $html[] = '<input'; |
||
| 78 | $html[] = ' type="hidden"'; |
||
| 79 | $html[] = ' name="' . htmlspecialchars($this->data['parameterArray']['itemFormElName']) . '"'; |
||
| 80 | $html[] = ' value="' . htmlspecialchars($this->data['parameterArray']['itemFormElValue']) . '"'; |
||
| 81 | $html[] = '/>'; |
||
| 82 | $html[] = '<table class="grideditor table table-bordered">'; |
||
| 83 | $html[] = '<tr>'; |
||
| 84 | $html[] = '<td colspan="2" align="center">'; |
||
| 85 | $html[] = '<div class="btn-group">'; |
||
| 86 | $html[] = '<a class="btn btn-default btn-sm t3js-grideditor-removerow-top" href="#"'; |
||
| 87 | $html[] = ' title="' . htmlspecialchars($lang->getLL('grid_removeRow')) . '">'; |
||
| 88 | $html[] = '<i class="fa fa-fw fa-minus"></i>'; |
||
| 89 | $html[] = '</a>'; |
||
| 90 | $html[] = '<a class="btn btn-default btn-sm t3js-grideditor-addrow-top" href="#"'; |
||
| 91 | $html[] = ' title="' . htmlspecialchars($lang->getLL('grid_addRow')) . '">'; |
||
| 92 | $html[] = '<i class="fa fa-fw fa-plus"></i>'; |
||
| 93 | $html[] = '</a>'; |
||
| 94 | $html[] = '</div>'; |
||
| 95 | $html[] = '</td>'; |
||
| 96 | $html[] = '</tr>'; |
||
| 97 | $html[] = '<tr>'; |
||
| 98 | $html[] = '<td class="editor_cell">'; |
||
| 99 | $html[] = '<div'; |
||
| 100 | $html[] = ' id="editor"'; |
||
| 101 | $html[] = ' class="t3js-grideditor"'; |
||
| 102 | $html[] = ' data-data="' . htmlspecialchars($json) . '"'; |
||
| 103 | $html[] = ' data-rowcount="' . (int)$this->rowCount . '"'; |
||
| 104 | $html[] = ' data-colcount="' . (int)$this->colCount . '"'; |
||
| 105 | $html[] = ' data-field="' . htmlspecialchars($this->data['parameterArray']['itemFormElName']) . '"'; |
||
| 106 | $html[] = '>'; |
||
| 107 | $html[] = '</div>'; |
||
| 108 | $html[] = '</td>'; |
||
| 109 | $html[] = '<td>'; |
||
| 110 | $html[] = '<div class="btn-group-vertical">'; |
||
| 111 | $html[] = '<a class="btn btn-default btn-sm t3js-grideditor-addcolumn" href="#"'; |
||
| 112 | $html[] = ' title="' . htmlspecialchars($lang->getLL('grid_addColumn')) . '">'; |
||
| 113 | $html[] = '<i class="fa fa-fw fa-plus"></i>'; |
||
| 114 | $html[] = '</a>'; |
||
| 115 | $html[] = '<a class="btn btn-default btn-sm t3js-grideditor-removecolumn" href="#"'; |
||
| 116 | $html[] = ' title="' . htmlspecialchars($lang->getLL('grid_removeColumn')) . '">'; |
||
| 117 | $html[] = '<i class="fa fa-fw fa-minus"></i>'; |
||
| 118 | $html[] = '</a>'; |
||
| 119 | $html[] = '</div>'; |
||
| 120 | $html[] = '</td>'; |
||
| 121 | $html[] = '</tr>'; |
||
| 122 | $html[] = '<tr>'; |
||
| 123 | $html[] = '<td colspan="2" align="center">'; |
||
| 124 | $html[] = '<div class="btn-group">'; |
||
| 125 | $html[] = '<a class="btn btn-default btn-sm t3js-grideditor-addrow-bottom" href="#"'; |
||
| 126 | $html[] = ' title="' . htmlspecialchars($lang->getLL('grid_addRow')) . '">'; |
||
| 127 | $html[] = '<i class="fa fa-fw fa-plus"></i>'; |
||
| 128 | $html[] = '</a>'; |
||
| 129 | $html[] = '<a class="btn btn-default btn-sm t3js-grideditor-removerow-bottom" href="#"'; |
||
| 130 | $html[] = ' title="' . htmlspecialchars($lang->getLL('grid_removeRow')) . '">'; |
||
| 131 | $html[] = '<i class="fa fa-fw fa-minus"></i>'; |
||
| 132 | $html[] = '</a>'; |
||
| 133 | $html[] = '</div>'; |
||
| 134 | $html[] = '</td>'; |
||
| 135 | $html[] = '</tr>'; |
||
| 136 | $html[] = '<tr>'; |
||
| 137 | $html[] = '<td colspan="2">'; |
||
| 138 | $html[] = '<a href="#" class="btn btn-default btn-sm t3js-grideditor-preview-button"></a>'; |
||
| 139 | $html[] = '<pre class="t3js-grideditor-preview-config grideditor-preview"><code></code></pre>'; |
||
| 140 | $html[] = '</td>'; |
||
| 141 | $html[] = '</tr>'; |
||
| 142 | $html[] = '</table>'; |
||
| 143 | $html[] = '</div>'; |
||
| 144 | if (!empty($fieldWizardHtml)) { |
||
| 145 | $html[] = '<div class="form-wizards-items-bottom">'; |
||
| 146 | $html[] = $fieldWizardHtml; |
||
| 147 | $html[] = '</div>'; |
||
| 148 | } |
||
| 149 | $html[] = '</div>'; |
||
| 150 | $html[] = '</div>'; |
||
| 151 | $html[] = '</div>'; |
||
| 152 | |||
| 153 | $html = implode(LF, $html); |
||
| 154 | $resultArray['html'] = $html; |
||
| 155 | $resultArray['requireJsModules'][] = ['TYPO3/CMS/Backend/GridEditor' => 'function(GridEditor) { new GridEditor.GridEditor(); }']; |
||
| 156 | $resultArray['additionalInlineLanguageLabelFiles'][] = 'EXT:core/Resources/Private/Language/locallang_wizards.xlf'; |
||
| 157 | $resultArray['additionalInlineLanguageLabelFiles'][] = 'EXT:backend/Resources/Private/Language/locallang.xlf'; |
||
| 158 | |||
| 159 | return $resultArray; |
||
| 160 | } |
||
| 242 |