Skip to content
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

Dispatch event in _getTemplateVars to allow other extensions to add custom vcl template variables #1439

Merged
merged 1 commit into from
Aug 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class Nexcessnet_Turpentine_Model_Varnish_Configurator_Version2
extends Nexcessnet_Turpentine_Model_Varnish_Configurator_Abstract {

const VCL_TEMPLATE_FILE = 'version-2.vcl';
const VCL_VERSION = '2';


/**
* Generate the Varnish 2.1-compatible VCL
Expand Down Expand Up @@ -55,6 +57,13 @@ protected function _getTemplateVars() {
$vars['esi_public_ttl'] = $this->_getDefaultTtl();
$vars['advanced_session_validation'] =
$this->_getAdvancedSessionValidation();

//dispatch event to allow other extensions to add custom vcl template variables
Mage::dispatchEvent('turpentine_get_templatevars_after', array(
'vars' => &$vars,
'vcl_version'=> self::VCL_VERSION
));

return $vars;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class Nexcessnet_Turpentine_Model_Varnish_Configurator_Version3
extends Nexcessnet_Turpentine_Model_Varnish_Configurator_Abstract {

const VCL_TEMPLATE_FILE = 'version-3.vcl';
const VCL_VERSION = '3';


/**
* Generate the Varnish 3.0-compatible VCL
Expand Down Expand Up @@ -60,6 +62,13 @@ protected function _getTemplateVars() {
$vars = parent::_getTemplateVars();
$vars['advanced_session_validation'] =
$this->_getAdvancedSessionValidation();

//dispatch event to allow other extensions to add custom vcl template variables
Mage::dispatchEvent('turpentine_get_templatevars_after', array(
'vars' => &$vars,
'vcl_version'=> self::VCL_VERSION
));

return $vars;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class Nexcessnet_Turpentine_Model_Varnish_Configurator_Version4
extends Nexcessnet_Turpentine_Model_Varnish_Configurator_Abstract {

const VCL_TEMPLATE_FILE = 'version-4.vcl';
const VCL_VERSION = '4';


/**
* Generate the Varnish 4.0-compatible VCL
Expand Down Expand Up @@ -72,6 +74,12 @@ protected function _getTemplateVars() {
$vars['set_backend_hint'] = '';
}

//dispatch event to allow other extensions to add custom vcl template variables
Mage::dispatchEvent('turpentine_get_templatevars_after', array(
'vars' => &$vars,
'vcl_version'=> self::VCL_VERSION
));

return $vars;
}

Expand Down