本文整理匯總了PHP中TYPO3\CMS\Core\TypoScript\TemplateService::splitConfArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP TemplateService::splitConfArray方法的具體用法?PHP TemplateService::splitConfArray怎麽用?PHP TemplateService::splitConfArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TYPO3\CMS\Core\TypoScript\TemplateService
的用法示例。
在下文中一共展示了TemplateService::splitConfArray方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: procesItemStates
/**
* Generating the per-menu-item configuration arrays based on the settings for item states (NO, RO, ACT, CUR etc) set in ->mconf (config for the current menu object)
* Basically it will produce an individual array for each menu item based on the item states. BUT in addition the "optionSplit" syntax for the values is ALSO evaluated here so that all property-values are "option-splitted" and the output will thus be resolved.
* Is called from the "generate" functions in the extension classes. The function is processor intensive due to the option split feature in particular. But since the generate function is not always called (since the ->result array may be cached, see makeMenu) it doesn't hurt so badly.
*
* @param integer $splitCount Number of menu items in the menu
* @return array An array with two keys: array($NOconf,$ROconf) - where $NOconf contains the resolved configuration for each item when NOT rolled-over and $ROconf contains the ditto for the mouseover state (if any)
* @access private
* @todo Define visibility
*/
public function procesItemStates($splitCount)
{
// Prepare normal settings
if (!is_array($this->mconf['NO.']) && $this->mconf['NO']) {
// Setting a blank array if NO=1 and there are no properties.
$this->mconf['NO.'] = array();
}
$NOconf = $this->tmpl->splitConfArray($this->mconf['NO.'], $splitCount);
// Prepare rollOver settings, overriding normal settings
$ROconf = array();
if ($this->mconf['RO']) {
$ROconf = $this->tmpl->splitConfArray($this->mconf['RO.'], $splitCount);
}
// Prepare IFSUB settings, overriding normal settings
// IFSUB is TRUE if there exist submenu items to the current item
if ($this->mconf['IFSUB']) {
// Flag: If $IFSUB is generated
$IFSUBinit = 0;
foreach ($NOconf as $key => $val) {
if ($this->isItemState('IFSUB', $key)) {
// if this is the first IFSUB element, we must generate IFSUB.
if (!$IFSUBinit) {
$IFSUBconf = $this->tmpl->splitConfArray($this->mconf['IFSUB.'], $splitCount);
if ($this->mconf['IFSUBRO']) {
$IFSUBROconf = $this->tmpl->splitConfArray($this->mconf['IFSUBRO.'], $splitCount);
}
$IFSUBinit = 1;
}
// Substitute normal with ifsub
$NOconf[$key] = $IFSUBconf[$key];
// If rollOver on normal, we must apply a state for rollOver on the active
if ($ROconf) {
// If RollOver on active then apply this
$ROconf[$key] = $IFSUBROconf[$key] ?: $IFSUBconf[$key];
}
}
}
}
// Prepare active settings, overriding normal settings
if ($this->mconf['ACT']) {
// Flag: If $ACT is generated
$ACTinit = 0;
// Find active
foreach ($NOconf as $key => $val) {
if ($this->isItemState('ACT', $key)) {
// If this is the first 'active', we must generate ACT.
if (!$ACTinit) {
$ACTconf = $this->tmpl->splitConfArray($this->mconf['ACT.'], $splitCount);
// Prepare active rollOver settings, overriding normal active settings
if ($this->mconf['ACTRO']) {
$ACTROconf = $this->tmpl->splitConfArray($this->mconf['ACTRO.'], $splitCount);
}
$ACTinit = 1;
}
// Substitute normal with active
$NOconf[$key] = $ACTconf[$key];
// If rollOver on normal, we must apply a state for rollOver on the active
if ($ROconf) {
// If RollOver on active then apply this
$ROconf[$key] = $ACTROconf[$key] ?: $ACTconf[$key];
}
}
}
}
// Prepare ACT (active)/IFSUB settings, overriding normal settings
// ACTIFSUB is TRUE if there exist submenu items to the current item and the current item is active
if ($this->mconf['ACTIFSUB']) {
// Flag: If $ACTIFSUB is generated
$ACTIFSUBinit = 0;
// Find active
foreach ($NOconf as $key => $val) {
if ($this->isItemState('ACTIFSUB', $key)) {
// If this is the first 'active', we must generate ACTIFSUB.
if (!$ACTIFSUBinit) {
$ACTIFSUBconf = $this->tmpl->splitConfArray($this->mconf['ACTIFSUB.'], $splitCount);
// Prepare active rollOver settings, overriding normal active settings
if ($this->mconf['ACTIFSUBRO']) {
$ACTIFSUBROconf = $this->tmpl->splitConfArray($this->mconf['ACTIFSUBRO.'], $splitCount);
}
$ACTIFSUBinit = 1;
}
// Substitute normal with active
$NOconf[$key] = $ACTIFSUBconf[$key];
// If rollOver on normal, we must apply a state for rollOver on the active
if ($ROconf) {
// If RollOver on active then apply this
$ROconf[$key] = $ACTIFSUBROconf[$key] ?: $ACTIFSUBconf[$key];
}
}
}
//.........這裏部分代碼省略.........
示例2: splitConfArraytest
/**
* @test
* @dataProvider splitConfDataProvider
* @see https://docs.typo3.org/typo3cms/TyposcriptReference/ObjectsAndProperties/Index.html#objects-optionsplit
*/
public function splitConfArraytest($configuration, $splitCount, $expected)
{
$actual = $this->templateService->splitConfArray($configuration, $splitCount);
$this->assertSame($expected, $actual);
}