Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

Commit

Permalink
[REMOVAL] Deprecate defaultExtras on Text component and VH
Browse files Browse the repository at this point in the history
The attribute is no longer supported on TYPO3 8.6+ and automatic migration is not possible.

The attribute is deprecated and will be removed in the next major version.
  • Loading branch information
NamelessCoder committed Jul 31, 2017
1 parent 00c3809 commit ed4bc00
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 47 deletions.
3 changes: 3 additions & 0 deletions Classes/Form/Field/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

use FluidTYPO3\Flux\Form\FieldInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
* Text
Expand Down Expand Up @@ -94,6 +95,7 @@ public function getColumns()
*/
public function setDefaultExtras($defaultExtras)
{
GeneralUtility::logDeprecatedFunction();
$this->defaultExtras = $defaultExtras;
return $this;
}
Expand All @@ -103,6 +105,7 @@ public function setDefaultExtras($defaultExtras)
*/
public function getDefaultExtras()
{
GeneralUtility::logDeprecatedFunction();
return $this->defaultExtras;
}

Expand Down
7 changes: 5 additions & 2 deletions Classes/ViewHelpers/Field/TextViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

use FluidTYPO3\Flux\Form\Field\Text;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface;

/**
Expand Down Expand Up @@ -36,7 +37,7 @@ public function initializeArguments()
$this->registerArgument(
'defaultExtras',
'string',
'FlexForm-syntax "defaultExtras" definition, example: "richtext[*]:rte_transform[mode=ts_css]"',
'DEPRECATED, IGNORED - has no function on TYPO3 8.7+. FlexForm-syntax "defaultExtras" definition, example: "richtext[*]:rte_transform[mode=ts_css]"',
false,
''
);
Expand Down Expand Up @@ -74,12 +75,14 @@ public function initializeArguments()
*/
public static function getComponent(RenderingContextInterface $renderingContext, array $arguments)
{
if (isset($arguments['defaultExtras'])) {
GeneralUtility::logDeprecatedViewHelperAttribute('defaultExtras', $renderingContext);
}
/** @var Text $text */
$text = static::getPreparedComponent('Text', $renderingContext, $arguments);
$text->setValidate($arguments['validate']);
$text->setColumns($arguments['cols']);
$text->setRows($arguments['rows']);
$text->setDefaultExtras($arguments['defaultExtras']);
$text->setEnableRichText($arguments['enableRichText']);
$text->setRenderType($arguments['renderType']);
$text->setFormat($arguments['format']);
Expand Down
37 changes: 0 additions & 37 deletions Tests/Unit/Form/Field/TextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*/
class TextTest extends InputTest
{

/**
* @var array
*/
Expand Down Expand Up @@ -42,40 +41,4 @@ public function canChainSetterForEnableRichText()
$this->assertSame($instance, $chained);
$this->assertTrue($instance->getEnableRichText());
}

/**
* @test
*/
public function canChainSetterForDefaultExtras()
{
/** @var Text $instance */
$instance = $this->createInstance();
$chained = $instance->setDefaultExtras('void');
$this->assertSame($instance, $chained);
$this->assertSame('void', $instance->getDefaultExtras());
}

/**
* @test
*/
public function canBuildConfigurationWithoutDefaultExtrasWithEnableRichText()
{
/** @var Text $instance */
$instance = $this->createInstance();
$instance->setDefaultExtras(null)->setEnableRichText(true);
$result = $this->performTestBuild($instance);
$this->assertArrayHasKey('defaultExtras', $result['config']);
}

/**
* @test
*/
public function canBuildConfigurationWithDefaultExtras()
{
/** @var Text $instance */
$instance = $this->createInstance();
$instance->setDefaultExtras('richtext[*]');
$result = $this->performTestBuild($instance);
$this->assertNotEmpty($result['defaultExtras']);
}
}
8 changes: 0 additions & 8 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable']['flux'] = \FluidTYPO3\Flux\Hooks\RecordListGetTableHookSubscriber::class;
}

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScript($_EXTKEY, 'setup', '
plugin.tx_flux.settings {
flexform {
rteDefaults = richtext:rte_transform[flag=rte_enabled|mode=ts_css]
}
}
');

if (TRUE === class_exists(\FluidTYPO3\Flux\Core::class)) {

// native Outlets, replaceable by short name in subsequent registerOutlet() calls by adding second argument (string, name of type)
Expand Down

0 comments on commit ed4bc00

Please sign in to comment.