Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Implement cookie consent from bootstrap_package branch 9.1.0
- Loading branch information
Showing
24 changed files
with
1,135 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the package buepro/pizpalue. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
/* | ||
* This file has been copied from the bootstrap_packeage V9 | ||
*/ | ||
namespace Buepro\Pizpalue\DataProcessing; | ||
|
||
use TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser; | ||
use TYPO3\CMS\Core\TypoScript\TypoScriptService; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; | ||
use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface; | ||
|
||
/** | ||
* Minimal TypoScript configuration | ||
* Assign all available typoscript constants for a key to template view, the | ||
* default key that is used is `page` and the default variable is `constants`. | ||
* | ||
* 10 = Buepro\Pizpalue\DataProcessing\ConstantsProcessor | ||
* | ||
* | ||
* Advanced TypoScript configuration | ||
* | ||
* 10 = Buepro\Pizpalue\DataProcessing\ConstantsProcessor | ||
* 10 { | ||
* key = page | ||
* as = constants | ||
* } | ||
*/ | ||
class ConstantsProcessor implements DataProcessorInterface | ||
{ | ||
/** | ||
* @param ContentObjectRenderer $cObj The data of the content element or page | ||
* @param array $contentObjectConfiguration The configuration of Content Object | ||
* @param array $processorConfiguration The configuration of this processor | ||
* @param array $processedData Key/value store of processed data (e.g. to be passed to a Fluid View) | ||
* @return array the processed data as key/value store | ||
*/ | ||
public function process(ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData) | ||
{ | ||
// The key to process | ||
$key = $cObj->stdWrapValue('key', $processorConfiguration); | ||
if (empty($key)) { | ||
$key = 'page'; | ||
} | ||
|
||
// Collect variables | ||
$flatConstants = $this->getFlatConstants($key); | ||
$typoScriptParser = GeneralUtility::makeInstance(TypoScriptParser::class); | ||
$typoScriptParser->parse($flatConstants); | ||
$typoScriptArray = $typoScriptParser->setup; | ||
$typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class); | ||
$constants = $typoScriptService->convertTypoScriptArrayToPlainArray($typoScriptArray); | ||
|
||
// Set the target variable | ||
$targetVariableName = $cObj->stdWrapValue('as', $processorConfiguration); | ||
if (!empty($targetVariableName)) { | ||
$processedData[$targetVariableName] = $constants; | ||
} else { | ||
$processedData['constants'] = $constants; | ||
} | ||
|
||
return $processedData; | ||
} | ||
|
||
/** | ||
* @param string $key | ||
* @return array | ||
*/ | ||
public function getFlatConstants($key) | ||
{ | ||
$flatvariables = ''; | ||
$prefix = $key . '.'; | ||
if (!isset($GLOBALS['TSFE']->tmpl->flatSetup) | ||
|| !is_array($GLOBALS['TSFE']->tmpl->flatSetup) | ||
|| count($GLOBALS['TSFE']->tmpl->flatSetup) === 0) { | ||
$GLOBALS['TSFE']->tmpl->generateConfig(); | ||
} | ||
foreach ($GLOBALS['TSFE']->tmpl->flatSetup as $constant => $value) { | ||
if (strpos($constant, $prefix) === 0) { | ||
$flatvariables .= substr($constant, strlen($prefix)) . ' = ' . $value . PHP_EOL; | ||
} | ||
} | ||
return $flatvariables; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
Extensions/bootstrap_package/Configuration/TypoScript/Helper/Block.typoscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
###################### | ||
### TEMPLATE BLOCK ### | ||
###################### | ||
# | ||
# TypoScript Example: | ||
# --------------- | ||
# | ||
# 10 < lib.block | ||
# 10.templateName = MyBlock | ||
# | ||
# | ||
# Fluid Example: | ||
# --------------- | ||
# | ||
# <f:cObject typoscriptObjectPath="lib.block" data="{template: 'MyBlock'}" /> | ||
# | ||
###################### | ||
lib.block = FLUIDTEMPLATE | ||
lib.block { | ||
|
||
################ | ||
### TEMPLATE ### | ||
################ | ||
templateName = Default | ||
templateName { | ||
override { | ||
field = template | ||
} | ||
} | ||
templateRootPaths { | ||
0 = EXT:bootstrap_package/Resources/Private/Templates/Blocks/ | ||
10 = {$plugin.bootstrap_package_blocks.view.templateRootPath} | ||
} | ||
partialRootPaths { | ||
0 = EXT:bootstrap_package/Resources/Private/Partials/Blocks/ | ||
10 = {$plugin.bootstrap_package_blocks.view.partialRootPath} | ||
} | ||
layoutRootPaths { | ||
0 = EXT:bootstrap_package/Resources/Private/Layouts/Blocks/ | ||
10 = {$plugin.bootstrap_package_blocks.view.layoutRootPath} | ||
} | ||
|
||
########################## | ||
### DATA PREPROCESSING ### | ||
########################## | ||
dataProcessing { | ||
1 = Buepro\Pizpalue\DataProcessing\ConstantsProcessor | ||
1 { | ||
as = theme | ||
key = page.theme | ||
} | ||
} | ||
|
||
} |
File renamed without changes.
Oops, something went wrong.