Skip to content

Commit

Permalink
Merge branch 'typo3-10'
Browse files Browse the repository at this point in the history
  • Loading branch information
butu committed Apr 28, 2020
2 parents 3dda956 + e84456b commit a501d00
Show file tree
Hide file tree
Showing 111 changed files with 3,214 additions and 2,534 deletions.
7 changes: 5 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ indent_size = 4
[*.ts]
indent_style = space
indent_size = 2

[*.js]
indent_style = space
indent_size = 2
Expand All @@ -59,24 +60,26 @@ indent_style = space
indent_size = 4

# YAML-Files
[{*.yaml,*.yml}]
[{*.yaml, *.yml}]
indent_style = space
indent_size = 2

# package.json
# .travis.yml
# bower.json
[{package.json,.travis.yml,bower.json}]
[{package.json, .travis.yml, bower.json}]
indent_style = space
indent_size = 2

# TypoScript
[*.typoscript]
indent_style = space
indent_size = 2

[*.ts]
indent_style = space
indent_size = 2

[*.tsconfig]
indent_style = space
indent_size = 2
Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.0.0] - 2020-04-28

### Added
- Support for TYPO3 v10. Thank you [Jürgen Venne](https://github.com/juergen-venne) and all the sponsors!

### Changed
- basic code cleanup and minor refactoring
- complete redesign of Mask backend module
- hidden IRRE elements are now visible in the backend[#262](https://github.com/Gernott/mask/pull/262)
- declared strict_types in all classes for better code quality
- replaced deprecated composer option "replace" with extra/extension-key
- moved the mask backend module to the bottom of the admin tools

### Removed
- Support for TYPO3 v9 LTS was dropped. Use Mask v4.x.x for TYPO3 v9 LTS

### Fixed
- Sort inline fields recursively to output correct order of fields in editor [#267](https://github.com/Gernott/mask/pull/267)
- Added softref-config to rte fields [#266](https://github.com/Gernott/mask/pull/266)
- Fixed TCA default value of field parentid for Inline-Tables [#249](https://github.com/Gernott/mask/pull/249)
- Fixed the path resolution in backend preview images


## [4.1.2] - 2019-08-27

### Changed
Expand Down
8 changes: 7 additions & 1 deletion Classes/Backend/BackendLayoutView.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace MASK\Mask\Backend;

Expand All @@ -15,13 +16,18 @@
* The TYPO3 project - inspiring people to share!
*/

use TYPO3\CMS\Backend\View\BackendLayout\DataProviderContext;

/**
* Backend layout for CMS
*/
class BackendLayoutView extends \TYPO3\CMS\Backend\View\BackendLayoutView
{

public function createDataProviderContext()
/**
* @return DataProviderContext
*/
public function createDataProviderContext(): DataProviderContext
{
return parent::createDataProviderContext();
}
Expand Down
21 changes: 21 additions & 0 deletions Classes/Backend/View/BackendLayout/BackendLayout.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);

namespace MASK\Mask\Backend\View\BackendLayout;

/**
* Class to represent a backend layout.
*/
class BackendLayout extends \TYPO3\CMS\Backend\View\BackendLayout\BackendLayout
{

/**
* @return array
*/
public function getColumnPositionNumbers(): array
{
$colPosList = parent::getColumnPositionNumbers();
$colPosList[] = 999;
return array_unique($colPosList);
}
}
12 changes: 8 additions & 4 deletions Classes/CodeGenerator/AbstractCodeGenerator.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace MASK\Mask\CodeGenerator;

Expand Down Expand Up @@ -26,6 +27,9 @@
* This copyright notice MUST APPEAR in all copies of the script!
* ************************************************************* */

use MASK\Mask\Domain\Repository\StorageRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
* Abstract base class for all the other code generators
*
Expand All @@ -37,17 +41,17 @@ abstract class AbstractCodeGenerator
/**
* StorageRepository
*
* @var \MASK\Mask\Domain\Repository\StorageRepository
* @var StorageRepository
*/
protected $storageRepository;

/**
* @param \MASK\Mask\Domain\Repository\StorageRepository $storageRepository
* @param StorageRepository $storageRepository
*/
public function __construct(\MASK\Mask\Domain\Repository\StorageRepository $storageRepository = null)
public function __construct(StorageRepository $storageRepository = null)
{
if (!$storageRepository) {
$this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository');
$this->storageRepository = GeneralUtility::makeInstance(StorageRepository::class);
} else {
$this->storageRepository = $storageRepository;
}
Expand Down
72 changes: 31 additions & 41 deletions Classes/CodeGenerator/HtmlCodeGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@
* This copyright notice MUST APPEAR in all copies of the script!
* ************************************************************* */

use MASK\Mask\Helper\FieldHelper;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
* Generates the html and fluid for mask content elements
*
* @author Benjamin Butschell <bb@webprofil.at>
*/
class HtmlCodeGenerator extends \MASK\Mask\CodeGenerator\AbstractCodeGenerator
class HtmlCodeGenerator extends AbstractCodeGenerator
{

/**
Expand All @@ -41,12 +44,12 @@ class HtmlCodeGenerator extends \MASK\Mask\CodeGenerator\AbstractCodeGenerator
* @author Gernot Ploiner <gp@webprofil.at>
*
*/
public function generateHtml($key, $table)
public function generateHtml($key, $table): string
{
$storage = $this->storageRepository->loadElement($table, $key);
$html = "";
if ($storage["tca"]) {
foreach ($storage["tca"] as $fieldKey => $fieldConfig) {
$html = '';
if ($storage['tca']) {
foreach ($storage['tca'] as $fieldKey => $fieldConfig) {
$html .= $this->generateFieldHtml($fieldKey, $key, $table);
}
}
Expand All @@ -61,72 +64,73 @@ public function generateHtml($key, $table)
* @param string $datafield
* @return string $html
* @author Gernot Ploiner <gp@webprofil.at>
* @author Benjamin Butschell <bb@webprofil.at>
*/
protected function generateFieldHtml($fieldKey, $elementKey, $table, $datafield = "data")
protected function generateFieldHtml($fieldKey, $elementKey, $table, $datafield = 'data'): string
{
$html = "";
$fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper');
$html = '';
$fieldHelper = GeneralUtility::makeInstance(FieldHelper::class);
switch ($fieldHelper->getFormType($fieldKey, $elementKey, $table)) {
case "Check":
$html .= "{f:if(condition: " . $datafield . "." . $fieldKey . ", then: 'On', else: 'Off')}<br />\n\n";
case 'Check':
$html .= '{f:if(condition: ' . $datafield . '.' . $fieldKey . ", then: 'On', else: 'Off')}<br />\n\n";
break;
case "Content":
case 'Content':
$html .= '<f:if condition="{' . $datafield . '.' . $fieldKey . '}">' . "\n";
$html .= "<f:for each=\"{" . $datafield . "." . $fieldKey . "}\" as=\"" . $datafield . "_item" . "\">\n";
$html .= '<f:for each="{' . $datafield . '.' . $fieldKey . '}" as="' . $datafield . '_item' . "\">\n";
$html .= '<f:cObject typoscriptObjectPath="lib.tx_mask.content">{' . $datafield . '_item.uid}</f:cObject><br />' . "\n";
$html .= "</f:for>\n";
$html .= "</f:if>\n\n";
break;
case "Date":
case 'Date':
$html .= '<f:if condition="{' . $datafield . '.' . $fieldKey . '}">' . "\n";
$html .= '<f:format.date format="d.m.Y">{' . $datafield . '.' . $fieldKey . '}</f:format.date><br />' . "\n";
$html .= "</f:if>\n\n";
break;
case "Datetime":
case 'Datetime':
$html .= '<f:if condition="{' . $datafield . '.' . $fieldKey . '}">' . "\n";
$html .= '<f:format.date format="d.m.Y - H:i:s">{' . $datafield . '.' . $fieldKey . '}</f:format.date><br />' . "\n";
$html .= "</f:if>\n\n";
break;
case "File":
case 'File':
$html .= '<f:if condition="{' . $datafield . '.' . $fieldKey . '}">' . "\n";
$html .= '<f:for each="{' . $datafield . '.' . $fieldKey . '}" as="file">
<f:image image="{file}" alt="{file.alternative}" title="{file.title}" width="200" /><br />
{file.description} / {file.identifier}<br />
</f:for>' . "\n";
$html .= "</f:if>\n\n";
break;
case "Float":
case 'Float':
$html .= '<f:if condition="{' . $datafield . '.' . $fieldKey . '}">' . "\n";
$html .= '<f:format.number decimals="2" decimalSeparator="," thousandsSeparator=".">{' . $datafield . '.' . $fieldKey . '}</f:format.number><br />' . "\n";
$html .= "</f:if>\n\n";
break;
case "Inline":
case 'Inline':
$html .= '<f:if condition="{' . $datafield . '.' . $fieldKey . '}">' . "\n";
$html .= "<ul>\n";
$html .= "<f:for each=\"{" . $datafield . "." . $fieldKey . "}\" as=\"" . $datafield . "_item" . "\">\n<li>";
$html .= '<f:for each="{' . $datafield . '.' . $fieldKey . '}" as="' . $datafield . '_item' . "\">\n<li>";
$inlineFields = $this->storageRepository->loadInlineFields($fieldKey);
if ($inlineFields) {
foreach ($inlineFields as $inlineField) {
$html .= $this->generateFieldHtml($inlineField["maskKey"], $elementKey, $fieldKey,
$datafield . "_item") . "\n";
$html .= $this->generateFieldHtml($inlineField['maskKey'], $elementKey, $fieldKey,
$datafield . '_item') . "\n";
}
}
$html .= "</li>\n</f:for>" . "\n";
$html .= "</ul>\n";
$html .= "</f:if>\n\n";
break;
case "Integer":
case 'String':
case 'Integer':
$html .= '<f:if condition="{' . $datafield . '.' . $fieldKey . '}">' . "\n";
$html .= '{' . $datafield . '.' . $fieldKey . '}<br />' . "\n";
$html .= "</f:if>\n\n";
break;
case "Link":
case 'Link':
$html .= '<f:if condition="{' . $datafield . '.' . $fieldKey . '}">' . "\n";
$html .= '<f:link.typolink parameter="{' . $datafield . '.' . $fieldKey . '}">{' . $datafield . '.' . $fieldKey . '}</f:link.typolink><br />' . "\n";
$html .= '<f:link.typolink parameter="{' . $datafield . '.' . $fieldKey . '}"></f:link.typolink><br />' . "\n";
$html .= "</f:if>\n\n";
break;
case "Radio":
case 'Select':
case 'Radio':
$html .= '<f:if condition="{' . $datafield . '.' . $fieldKey . '}">' . "\n";
$html .= '<f:switch expression="{' . $datafield . '.' . $fieldKey . '}">
<f:case value="1">Value is: 1</f:case>
Expand All @@ -135,26 +139,12 @@ protected function generateFieldHtml($fieldKey, $elementKey, $table, $datafield
</f:switch><br />' . "\n";
$html .= "</f:if>\n\n";
break;
case "Richtext":
case 'Richtext':
$html .= '<f:if condition="{' . $datafield . '.' . $fieldKey . '}">' . "\n";
$html .= '<f:format.html parseFuncTSPath="lib.parseFunc_RTE">{' . $datafield . '.' . $fieldKey . '}</f:format.html><br />' . "\n";
$html .= "</f:if>\n\n";
break;
case "Select":
$html .= '<f:if condition="{' . $datafield . '.' . $fieldKey . '}">' . "\n";
$html .= '<f:switch expression="{' . $datafield . '.' . $fieldKey . '}">
<f:case value="1">Value is: 1</f:case>
<f:case value="2">Value is: 2</f:case>
<f:case value="3">Value is: 3</f:case>
</f:switch><br />' . "\n";
$html .= "</f:if>\n\n";
break;
case "String":
$html .= '<f:if condition="{' . $datafield . '.' . $fieldKey . '}">' . "\n";
$html .= '{' . $datafield . '.' . $fieldKey . '}<br />' . "\n";
$html .= "</f:if>\n\n";
break;
case "Text":
case 'Text':
$html .= '<f:if condition="{' . $datafield . '.' . $fieldKey . '}">' . "\n";
$html .= '<f:format.nl2br>{' . $datafield . '.' . $fieldKey . '}</f:format.nl2br><br />' . "\n";
$html .= "</f:if>\n\n";
Expand Down
3 changes: 2 additions & 1 deletion Classes/CodeGenerator/JsonCodeGenerator.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace MASK\Mask\CodeGenerator;

Expand Down Expand Up @@ -32,7 +33,7 @@
*
* @author Benjamin Butschell <bb@webprofil.at>
*/
class JsonCodeGenerator extends \MASK\Mask\CodeGenerator\AbstractCodeGenerator
class JsonCodeGenerator extends AbstractCodeGenerator
{
//put your code here
}
Loading

0 comments on commit a501d00

Please sign in to comment.