-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ContentDefender configuration in PageTSConfig #454
Comments
Here is the extending class we use in our project to enable the mentioned behaviour... it basically checks if there's a PageTSConfig configuration for the content defender settings. <?php
declare(strict_types=1);
namespace Fnn\FnnContainerExtended\Tca;
use TYPO3\CMS\Backend\Utility\BackendUtility;
class Registry extends \B13\Container\Tca\Registry
{
public function getContentDefenderConfiguration(string $cType, int $colPos): array
{
$currentPageId = (int)$_GET['id'];
$ctypeConfig = BackendUtility::getPagesTSconfig($currentPageId)['lib.']['fnnContainerExtended.'][$cType.'.'] ?? [];
$contentDefenderConfiguration = [];
$rows = $this->getGrid($cType);
foreach ($rows as $columns) {
foreach ($columns as $column) {
if ((int)$column['colPos'] === $colPos) {
if (isset($column['allowed']) && !empty($column['allowed'])) {
$contentDefenderConfiguration['allowed.'] = $column['allowed'];
} else {
$contentDefenderConfiguration['allowed.'] = $ctypeConfig[$colPos.'.']['allowed.'] ?? [];
}
if (isset($column['disallowed']) && !empty($column['disallowed'])) {
$contentDefenderConfiguration['disallowed.'] = $column['disallowed'];
} else {
$contentDefenderConfiguration['disallowed.'] = $ctypeConfig[$colPos.'.']['disallowed.'] ?? [];
}
if (isset($column['maxitems']) && !is_null($column['maxitems'])) {
$contentDefenderConfiguration['maxitems'] = $column['maxitems'];
} else {
$contentDefenderConfiguration['maxitems'] = $ctypeConfig[$colPos.'.']['maxitems'] ?? 0;
}
}
}
}
return $contentDefenderConfiguration;
}
} |
Hi @599media , you can do so, but this will not goes into the EXT:container Code, because it depends on the Request (s. |
@achimfritz Thanks for your feedback. Can I ask, what kind of CLI actions or POST requests you have in mind? And maybe you could also give us a hint about the possible additional side effects? Maybe we can come up with a more robust solution. An answer would be very much appreciated! |
Hi and thanks for the great work!
We're migrating some projects from ext:gridelements. As you might know gridelements has an integrated content_defender. The configuration there can be done via PageTSConfig and is therefor page-based (which is great for multi-site instances). In ext:container the content defender configuration can only be done via TCA and is therfor global if we're not mistaken.
Are there any plans on changing or extending this?
We did have a look at the getContentDefenderConfiguration-function in the Registry.php. It seems like the actual content_defender stuff is done on-the-fly. So you actually can access the PageTSConfig of the current page and are potentially able to override the global TCA-based content_defender configuration. Since we need this pretty badly, we are extending the class and try to implement this feature. Are you interested in pull request when we're done or is this something you don't see in ext:container?
The text was updated successfully, but these errors were encountered: