This is a performance comparison for various repeatable content fields in ProcessWire. Each block contains five blocks of Lorem Ipsum and measured time includes the complete rendering process including iteration and retrieving content from the database:
From a performance view the ProFields Table clearly outperforms all other variants, since it does not need secondary templates to obtain information about the content to render. PageTable and all Repeater variants basically use a very similar semantic regarding data storage, each "entry" is stored in a page with a dedicated template. As a consequent timings are rather similar for these types, yet there are differences in details due to the more or less complex operations to realize the functionality.
The RepeaterFlex is designed with performance in mind, which already is significant in this very simple example and will get more obvious with more complex items. Interesting fact is, that it may even outperform the regular Repeater if depth information is used.
For isolated performance tests you may switch the rendering type for Repeater from the links below. They basically switch the informations retrieved from the repeater to compare the timings (variants 6 and 7 are also implemented for the RepeaterMatrix):
foreach($page->bodytext_repeater as $pg)
{
$pg->setForField($page->bodytext_repeater->getField());
$pg->setForPage($page->bodytext_repeater->getParent());
On this server this conserves few mSec per interated repeater item.You'll find the current template code of this page below, open each accordion entry to see the particular iteration loop.
$ForPageIDs = array(); foreach($page->bodytext_repeater as $pg) { $ForPageIDs[] = $pg->getForPage()->id; } return('ForPages: '.implode(', ', $ForPageIDs));ForPages: 1160, 1160, 1160, 1160, 1160
$cont = ''; foreach($page->bodytext_matrix as $pg) { $cont .= $pg->bodytext; } return($cont);
consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.
return $page->flex_content->render() ;
consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.
return $page->flex_footer->render();
consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.
return $page->flex_basic->render();
consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.
$cont = ''; foreach($page->bodytext_pagetable as $pg) { $cont .= $pg->bodytext; } return($cont);
consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.
$cont = ''; foreach($page->bodytext_table as $pg) { $cont .= $pg->bodytext; } return($cont);
consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.
<?php namespace ProcessWire;
$bShowFunctionSource = true; // Enable to display closure code in rendered output
$Variants = [ // Variants displayed on top of the page
0 => 'default',
1 => 'DepthAcc',
2 => 'PageIDs',
3 => 'ForFieldIDs',
4 => 'ForFieldIDs+Content',
5 => 'ForPageIDs',
6 => 'ForPageIDs+Content',
7 => 'Preload,FieldIDs+Content',
];
$variant = (int)$input->get('variant');
function getFormatted($Sourcecode, $bUsePrism=false) // Format PHP sourcecode
{
$modules = wire('modules');
$modules->TextformatterEntities->formatValue(new Page(), new Field(), $Sourcecode);
if($bUsePrism)
{
$Sourcecode = '<code class="language-php">'.$Sourcecode.'</code>';
$modules->TextformatterPrism->formatValue(new Page(), new Field(), $Sourcecode);
}
return '<pre>' . $Sourcecode . '</pre>';
}
function Test($Title, $func) // Perform timing test on function
{
$tStart = microtime(true);
$rendered = $func();
$tEnd = microtime(true);
$tm = sprintf("%.1fms", ($tEnd-$tStart)*1000);
return [ 'title' => $Title,
'rendered' => $rendered,
// 'text' => "<li><a class='uk-accordion-title' href='#'>{$Title}: {$tm}</a><div class='uk-accordion-content'>{$rendered}</div></li>",
'func' => $func,
'time' => $tm ];
}
$content = '<div class="uk-container uk-padding">';
$content .= '<h1>Performance Testing'.($variant?", variant $variant":"").'</h1>';
// Replace ##id## tags from bodytext into dynamic links
$content .= preg_replace_callback('/##(\d+)##/', function($matches) use($variant,$Variants) {
$idx = (int)$matches[1];
if(isset($Variants[$idx]))
{
$out = "<b>{$idx}: {$Variants[$idx]}</b>";
if($variant != $idx)
$out = "<a href='./?variant={$idx}'>{$out}</a>";
}
else
$out = (string)$idx;
return($out);
}, $page->bodytext);
/*
$content .= '<div>Rendering Type:';
foreach($Variants as $k => $v)
$content .= " <a href='?variant=$k'>$k: $v</a>";
$content .= '</div>';
*/
$content .= '<hr>';
$content .= '<ul uk-accordion>';
$Times = array();
switch($variant)
{
default:
$Times['Repeater'] = Test('Repeater (1 CKEditor field in template), Output Bodytext',
function() use ($page) {
$cont = '';
foreach($page->bodytext_repeater as $pg)
{
$cont .= $pg->bodytext;
}
return($cont);
});
break;
case 1:
$Times['RepeaterDepthAcc'] = Test('Repeater (1 CKEditor field in template), Depth Accumulator',
function() use ($page) {
$d = 0;
foreach($page->bodytext_repeater as $pg)
{
$d += $pg->depth;
}
return("Total Depth: {$d}");
});
break;
case 2:
$Times['RepeaterPages'] = Test('Repeater (1 CKEditor field in template), PageID collector',
function() use ($page) {
$PageIDs = array();
foreach($page->bodytext_repeater as $pg)
{
$PageIDs[] = $pg->id;
}
return('PageIDs: '.implode(', ', $PageIDs));
});
break;
case 3:
$Times['RepeaterForFields'] = Test('Repeater (1 CKEditor field in template), ForFieldID collector',
function() use ($page) {
$ForFieldIDs = array();
foreach($page->bodytext_repeater as $pg)
{
$ForFieldIDs[] = $pg->getForField()->id;
}
return('ForFields: '.implode(', ', $ForFieldIDs));
});
break;
case 4:
$Times['RepeaterForFieldsContent'] = Test('Repeater (1 CKEditor field in template), ForFieldID collector and Content',
function() use ($page) {
$ForFieldIDs = array();
$cont = '';
foreach($page->bodytext_repeater as $pg)
{
$ForFieldIDs[] = $pg->getForField()->id;
$cont .= $pg->bodytext;
}
return($cont.'ForFields: '.implode(', ', $ForFieldIDs));
});
break;
case 5:
$Times['RepeaterForPages'] = Test('Repeater (1 CKEditor field in template), ForPageID collector',
function() use ($page) {
$ForPageIDs = array();
foreach($page->bodytext_repeater as $pg)
{
$ForPageIDs[] = $pg->getForPage()->id;
}
return('ForPages: '.implode(', ', $ForPageIDs));
});
break;
case 6:
$Times['RepeaterForPagesContent'] = Test('Repeater (1 CKEditor field in template), ForPageID collector and Content',
function() use ($page) {
$ForPageIDs = array();
$cont = '';
foreach($page->bodytext_repeater as $pg)
{
$ForPageIDs[] = $pg->getForPage()->id;
$cont .= $pg->bodytext;
}
return($cont.'ForPages: '.implode(', ', $ForPageIDs));
});
break;
case 7:
$Times['RepeaterForFieldsContentPreset'] = Test('Repeater (1 CKEditor field in template), ForFieldID collector and Content, presetting ForField&Page',
function() use ($page) {
$ForFieldIDs = array();
$cont = '';
foreach($page->bodytext_repeater as $pg)
{
$pg->setForField($page->bodytext_repeater->getField());
$pg->setForPage($page->bodytext_repeater->getParent());
$ForFieldIDs[] = $pg->getForField()->id;
$cont .= $pg->bodytext;
}
return($cont.'ForFields: '.implode(', ', $ForFieldIDs));
});
break;
}
switch($variant)
{
default:
$Times['RepeaterMatrix'] = Test('RepeaterMatrix (1 CKEditor field in template)',
function() use ($page) {
$cont = '';
foreach($page->bodytext_matrix as $pg)
{
$cont .= $pg->bodytext;
}
return($cont);
});
break;
case 6:
$Times['RepeaterMatrixForPagesContent'] = Test('RepeaterMatrix (1 CKEditor field in template), ForPageID collector and Content',
function() use ($page) {
$ForPageIDs = array();
$cont = '';
foreach($page->bodytext_matrix as $pg)
{
$ForPageIDs[] = $pg->getForPage()->id;
$cont .= $pg->bodytext;
}
return($cont.'ForPages: '.implode(', ', $ForPageIDs));
});
break;
case 7:
$Times['RepeaterMatrixForFieldsContentPreset'] = Test('RepeaterMatrix (1 CKEditor field in template), presetting ForPage/ForField',
function() use ($page) {
$cont = '';
foreach($page->bodytext_matrix as $pg)
{
$pg->setForField($page->bodytext_matrix->getField());
$pg->setForPage($page->bodytext_matrix->getParent());
$cont .= $pg->bodytext;
}
return($cont);
});
break;
}
// bd('FlexRepeater');
$Times['Flex'] = Test('Flex Repeater (18 fields in template, ContentRenderer)',
function() use ($page) {
return $page->flex_content->render() ;
});
// bd('FlexFooter');
$Times['FlexFooter'] = Test('Flex Footer (6 fields in template, ContentRenderer)',
function() use ($page) {
return $page->flex_footer->render();
});
// bd('Flex...');
$Times['FlexBasic'] = Test('Flex Basic (1 CKEditor field)',
function() use ($page) {
return $page->flex_basic->render();
});
$Times['PageTable'] = Test('Page Table (1 CKEditor field on page)',
function() use ($page) {
$cont = '';
foreach($page->bodytext_pagetable as $pg)
{
$cont .= $pg->bodytext;
}
return($cont);
});
$Times['ProTable'] = Test('Profields Table (1 CKEditor field)',
function() use ($page) {
$cont = '';
foreach($page->bodytext_table as $pg)
{
$cont .= $pg->bodytext;
}
return($cont);
});
// Output content
$FileContent = file_get_contents(__FILE__); // Sourcefile content
$FileLines = explode("\n", $FileContent); // Split by lines
foreach($Times as $tm) // Output everything as accordion
{
$output = '';
if($bShowFunctionSource)
{
$r = new \ReflectionFunction($tm['func']);
$FuncSource = '';
for($l = $r->getStartLine(); $l < ($r->getEndLine()-1); $l++)
$FuncSource .= $FileLines[$l];
$output .= getFormatted($FuncSource);
}
$output .= $tm['rendered'];
$content .= "<li><a class='uk-accordion-title' href='#'>{$tm['title']}: {$tm['time']}</a><div class='uk-accordion-content'>{$output}</div></li>";
}
$content .= '<hr/><h2>This File:</h2>';
$content .= getFormatted($FileContent, true);
$content .= '</div>';