Commit 69a7dc10 authored by Fabian Galinski's avatar Fabian Galinski

[TASK] Provide compatibility with the old user_function

parent d561b172
......@@ -28,6 +28,7 @@ namespace TYPO3\Languagevisibility\UserFunction;
use Doctrine\DBAL\DBALException;
use Exception;
use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
use TYPO3\CMS\Backend\Form\NodeFactory;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Cache\CacheManager;
......@@ -66,6 +67,37 @@ class FieldVisibilityUserFunction extends AbstractFormElement {
*/
private $modTSconfig = [];
/**
* Constructor
*
* @param NodeFactory $nodeFactory
* @param array $data
*/
public function __construct(NodeFactory $nodeFactory = null, array $data = []) {
if ($nodeFactory !== NULL) {
parent::__construct($nodeFactory, $data);
}
$this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
}
/**
* Renders the language table for the given record
*
* @deprecated
* @param array $PA row data
* @return string
* @noinspection PhpUnused
* @throws DBALException
*/
public function user_fieldvisibility($PA): string {
$this->data['databaseRow'] = $PA['row'];
$this->data['effectivePid'] = $PA['row']['pid'];
$this->data['tableName'] = $PA['table'];
$this->data['fieldName'] = $PA['field'];
return $this->render()['html'];
}
/**
* @return array
*/
......@@ -170,18 +202,6 @@ class FieldVisibilityUserFunction extends AbstractFormElement {
return $result;
}
/**
* Renders the language table for the given record
*
* @param array $PA row data
* @return string
* @noinspection PhpUnused
* @throws DBALException
*/
public function user_fieldvisibility($PA): string {
}
/**
* This method is used to generate an infoStructure array, which will be
* rendered as a Form
......
......@@ -6,6 +6,36 @@
- Upgrade Wizard: Execute the "VisibilitySettingsMigrationWizard"-Wizard.
- Remove all old fields.
# Version 4 Breaking Changes
## Additional Breaking Changes for Version 3.1
- Dropped TYPO3 8 Support
### Migrate the "Extend your table" registrations to the new code
The function "user_fieldvisibility" is deprecated and might be removed in the next major version.
**Old Code:**
```php
'tx_languagevisibility_visibility' => [
'exclude' => 1,
'label' => 'LLL:EXT:languagevisibility/locallang_db.xlf:pages.tx_languagevisibility_visibility',
'config' => [
'type' => 'user',
'userFunc' => 'TYPO3\Languagevisibility\UserFunction\FieldVisibilityUserFunction->user_fieldvisibility',
]
],
```
**New Code:**
```php
'tx_languagevisibility_visibility' => [
'exclude' => 1,
'label' => 'LLL:EXT:languagevisibility/locallang_db.xlf:pages.tx_languagevisibility_visibility',
'config' => [
'type' => 'user',
'renderType' => 'languageVisibility'
]
]
```
......@@ -122,5 +122,11 @@ call_user_func(
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['visibilitySettingsMigrationWizard']
= \TYPO3\Languagevisibility\Updates\VisibilitySettingsMigrationWizard::class;
// Node registration
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry']['1597679991'] = [
'nodeName' => 'languageVisibility',
'priority' => 40,
'class' => \TYPO3\Languagevisibility\UserFunction\FieldVisibilityUserFunction::class,
];
}
);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment