summaryrefslogtreecommitdiffstats
path: root/provision.api.php
diff options
context:
space:
mode:
authorJon Pugh2017-02-16 14:03:56 (GMT)
committerJon Pugh2017-02-16 14:03:56 (GMT)
commitbcd19f36a6f9b3718d2527031b3ee05571c36c5c (patch)
tree4bee284018ad68835dcc39ee68f96d40e873215c /provision.api.php
parent874d0945985953abe3f1bf924f632d2e81e6d10a (diff)
Issue #2853184: In the Provision_Config::render_template() method, add drush_command_invoke_all_ref() to create hook_provision_config_variables_alter(), allowing drush files to alter variables right before they are written to templates.
Diffstat (limited to 'provision.api.php')
-rw-r--r--provision.api.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/provision.api.php b/provision.api.php
index 3f491ff..855f9cf 100644
--- a/provision.api.php
+++ b/provision.api.php
@@ -216,6 +216,31 @@ function hook_provision_config_load_templates_alter(&$templates, $config) {
}
/**
+ * Alter the template and variables used for rendering a config file.
+ *
+ * When implementing this hook, the function name should start with your file's name, not "drush_".
+ *
+ * @param $variables
+ * The variables that are about to be injected into the template.
+ * @param $template
+ * The template file chosen for use
+ * @param $config
+ * The Provision_config object trying to find its template.
+ *
+ * @see hook_provision_config_load_templates()
+ * @see hook_provision_config_load_templates_alter()
+ */
+function hook_provision_config_variables_alter(&$variables, $templates, $config) {
+
+ // If this is the vhost template and the http service is Docker...
+ if (is_a($config, 'Provision_Config_Apache_Site') && is_a(d()->platform->service('http'), 'Provision_Service_http_apache_docker')) {
+
+ // Force the listen port to be 80.
+ $variables['http_port'] = '80';
+ }
+}
+
+/**
* Alter the array of directories to create.
*
* @param $mkdir