EsiValidateRenderStrategy.php in Render cache 7.2
File
modules/renderer/render_cache_esi_validate/src/RenderCache/RenderStrategy/EsiValidateRenderStrategy.php
View source
<?php
namespace Drupal\render_cache_esi_validate\RenderCache\RenderStrategy;
use Drupal\render_cache\RenderCache\RenderStrategy\BaseRenderStrategy;
class EsiValidateRenderStrategy extends BaseRenderStrategy {
public function render(array $args) {
$placeholders = array();
if (empty($_SERVER['HTTP_X_DRUPAL_ESI_VALIDATE'])) {
return array();
}
foreach ($args as $placeholder => $ph_object) {
if (empty($ph_object['cache_info']['cid'])) {
continue;
}
$base_esi = 'render-cache/esi-validate-render';
if (variable_get('render_cache_esi_use_php_script', FALSE)) {
$base_esi = drupal_get_path('module', 'esi_render_cache') . '/esi_validate.php';
}
$url = url($base_esi, array(
'query' => array(
'cid' => $ph_object['cache_info']['cid'],
'bin' => $ph_object['cache_info']['bin'],
),
));
$placeholders[$placeholder] = array(
'#markup' => '<esi:include src="' . $url . '" />',
);
}
return $placeholders;
}
}