Skip to content

Commit

Permalink
[TASK] lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaseberle committed Nov 23, 2020
1 parent 3f27056 commit 3828d9f
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 52 deletions.
44 changes: 23 additions & 21 deletions Classes/Generator/FlexFormGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class FlexFormGenerator
*/
protected $dataService;

public function __construct(DataService $dataService) {
public function __construct(DataService $dataService)
{
$this->dataService = $dataService;
}

Expand Down Expand Up @@ -121,17 +122,19 @@ protected function createInputField(array $field, array $contentBlock) :string
$additionlConfig .= '
<range>
<lower>' . floatval(
($field['properties']['range']['lower'] !== ''
(
$field['properties']['range']['lower'] !== ''
? $field['properties']['range']['lower']
: '0'
)
) . '</lower>
)
) . '</lower>
<upper>' . floatval(
($field['properties']['range']['upper'] !== ''
(
$field['properties']['range']['upper'] !== ''
? $field['properties']['range']['upper']
: '100'
)
) . '</upper>
)
) . '</upper>
</range>';
}
if ($field['type'] === 'Percent') {
Expand Down Expand Up @@ -290,11 +293,12 @@ protected function createTextarea(array $field, array $contentBlock) :string
<rows>' . ($field['properties']['rows'] === true ? $field['properties']['rows'] : '3') . '</rows>
' . ($field['properties']['enableRichtext'] === true ? '<enableRichtext>true</enableRichtext>' : '') . '
' . (
strlen(
$field['properties']['richtextConfiguration'] . ''
) > 0
strlen(
$field['properties']['richtextConfiguration'] . ''
) > 0
? '<richtextConfiguration>' . $field['properties']['richtextConfiguration'] . '</richtextConfiguration>'
: '') . '
: ''
) . '
<eval>' . ($field['properties']['required'] === true ? 'required' : '') . ($field['properties']['trim'] === true && $field['properties']['required'] === true ? ', ' : '') . ($field['properties']['trim'] === true ? 'trim ' : '') . '</eval>
<placeholder>' . $field['properties']['placeholder'] . '</placeholder>
<default>' . $field['properties']['default'] . '</default>
Expand All @@ -315,8 +319,7 @@ protected function createCollection(array $field, array $contentBlock) :string
foreach ($field['properties']['fields'] as $collectionField) {
if ($collectionField['type'] === 'Collection') {
$fieldsConfig = $fieldsConfig . $this->createCollection($collectionField, $contentBlock);
}
else {
} else {
$fieldsConfig .= $this->createField($collectionField, $contentBlock);
}
}
Expand Down Expand Up @@ -360,12 +363,12 @@ protected function createCollection(array $field, array $contentBlock) :string
. '</content_block_field_identifier>
</foreign_match_fields>'
. (
($field['properties']['minItems'] ?? false)
($field['properties']['minItems'] ?? false)
? '<minItems>' . $field['properties']['minItems'] . '</minItems>'
: ''
)
. (
($field['properties']['maxItems'] ?? false)
($field['properties']['maxItems'] ?? false)
? '<maxItems>' . $field['properties']['maxItems'] . '</maxItems>'
: ''
)
Expand Down Expand Up @@ -538,26 +541,25 @@ protected function createField(array $field, array $contentBlock) :string
case 'Date':
case 'DateTime':
case 'Time':
return FlexFormGenerator::createInputField($field, $contentBlock);
return $this->createInputField($field, $contentBlock);
case 'Textarea':
case 'TextMultiline':
return FlexFormGenerator::createTextarea($field, $contentBlock);
return $this->createTextarea($field, $contentBlock);
case 'Link':
case 'Url':
return FlexFormGenerator::createTypoLink($field, $contentBlock);
return $this->createTypoLink($field, $contentBlock);
case 'Image':
case 'Icon':
return FlexFormGenerator::createImageField($field, $contentBlock);
return $this->createImageField($field, $contentBlock);
case 'Select':
case 'Checkbox':
case 'MultiSelect':
case 'Radiobox':
case 'Toggle':
return FlexFormGenerator::createSelections($field, $contentBlock);
return $this->createSelections($field, $contentBlock);
default:
return '';
}
}
}
}

9 changes: 4 additions & 5 deletions Classes/Generator/TcaGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@

namespace Typo3Contentblocks\ContentblocksRegApi\Generator;

use Typo3Contentblocks\ContentblocksRegApi\Service\ConfigurationService;
use Typo3Contentblocks\ContentblocksRegApi\Generator\FlexFormGenerator;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use Typo3Contentblocks\ContentblocksRegApi\Service\ConfigurationService;

class TcaGenerator
{
/**
* Get default flexform configuration of the tt_content.content_block field
*
*
*/
public function contentBlockFlexformColumnTca() :array
{
Expand Down Expand Up @@ -125,8 +124,8 @@ public function setTca() :void
/***************
* Add flexForms for content element configuration
*/
$flexFormGenerator = GeneralUtility::makeInstance(FlexFormGenerator::class)
->createFlexform($contentBlock );
GeneralUtility::makeInstance(FlexFormGenerator::class)
->createFlexform($contentBlock);
}
}
}
1 change: 0 additions & 1 deletion Classes/Service/ConfigurationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ function ($e) use ($path) {
);
}


/**
* @param string $cType
* @param array $path
Expand Down
52 changes: 27 additions & 25 deletions Configuration/TCA/tx_contentblocks_reg_api_collection.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

declare(strict_types=1);

/*
* This file is part of the package bk2k/bootstrap-package.
* This file is part of the package typo3-contentblocks/contentblocks-reg-api.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
Expand Down Expand Up @@ -36,7 +38,7 @@
'endtime' => 'endtime',
],
'typeicon_classes' => [
'default' => 'ext-contentblocks_reg_api'
'default' => 'ext-contentblocks_reg_api',
],
],
'interface' => [
Expand All @@ -53,23 +55,23 @@
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.visibility;visibility,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,
--palette--;;hiddenLanguagePalette,
'
',
],
],
'palettes' => [
'1' => [
'showitem' => ''
'showitem' => '',
],
'access' => [
'showitem' => '
starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:starttime_formlabel,
endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:endtime_formlabel
'
',
],
'visibility' => [
'showitem' => '
hidden;LLL:EXT:bootstrap_package/Resources/Private/Language/Backend.xlf:card_group_item
'
',
],
// hidden but needs to be included all the time, so sys_language_uid is set correctly
'hiddenLanguagePalette' => [
Expand All @@ -88,10 +90,10 @@
[
0 => '',
1 => '',
'invertStateDisplay' => true
]
'invertStateDisplay' => true,
],
],
]
],
],
'starttime' => [
'exclude' => true,
Expand All @@ -100,10 +102,10 @@
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'default' => 0
'default' => 0,
],
'l10n_mode' => 'exclude',
'l10n_display' => 'defaultAsReadonly'
'l10n_display' => 'defaultAsReadonly',
],
'endtime' => [
'exclude' => true,
Expand All @@ -114,11 +116,11 @@
'eval' => 'datetime',
'default' => 0,
'range' => [
'upper' => mktime(0, 0, 0, 1, 1, 2038)
]
'upper' => mktime(0, 0, 0, 1, 1, 2038),
],
],
'l10n_mode' => 'exclude',
'l10n_display' => 'defaultAsReadonly'
'l10n_display' => 'defaultAsReadonly',
],
'sys_language_uid' => [
'exclude' => 1,
Expand All @@ -131,15 +133,15 @@
'items' => [
[
'LLL:' . $generalLanguageFile . ':LGL.allLanguages',
-1
-1,
],
[
'LLL:' . $generalLanguageFile . ':LGL.default_value',
0
]
0,
],
],
'allowNonIdValues' => true,
]
],
],
'l10n_parent' => [
'displayCond' => 'FIELD:sys_language_uid:>:0',
Expand All @@ -151,18 +153,18 @@
'items' => [
[
'',
0
]
0,
],
],
'foreign_table' => 'tx_contentblocks_reg_api_collection',
'foreign_table_where' => 'AND tx_contentblocks_reg_api_collection.pid=###CURRENT_PID### AND tx_contentblocks_reg_api_collection.sys_language_uid IN (-1,0)',
'default' => 0
]
'default' => 0,
],
],
'l10n_diffsource' => [
'config' => [
'type' => 'passthrough'
]
'type' => 'passthrough',
],
],
'content_block' => [
'label' => 'Content Block Data',
Expand Down Expand Up @@ -197,6 +199,6 @@
'type' => 'input',
'size' => 500,
],
]
],
],
];

0 comments on commit 3828d9f

Please sign in to comment.