During normal Drupal development, when you’re developing your website’s themes, best practices would have you store a theme’s files in the sites/all/themes directory under your docroot directory. If you want a design team to create and maintain your websites’ theme files without granting them access to your websites’ code, you can set up an external theme repository.
Site Factory allows you to configure a link to an external Git repository containing one or more themes for use with your Drupal website. After connecting your website to a Git repository containing one or more themes, the themes will display when you click Appearance in the admin menu.
When creating your external Git repository, ensure the repository contains the following items:
Cloud Platform requires deployment keys be associated with a user account. As GitHub does not support the use of the same deployment key for multiple repositories, create a Cloud Platform user as described in Deployment keys and Cloud Platform. Associate the key with a user account, instead of adding the SSH key as a deployment key.
To protect hosted websites from using themes containing potentially harmful settings or code, you can add a allowlist file of approved theme repositories to Site Factory. When administrative users try to add a theme repository, Site Factory compares the repository with the contents of the acsf_theme_allowlist.txt file.
To create an allowlist file for your theme repositories:
# ). The # isn’t used for allowlist filtering.* ) for wildcard entry.acsf_theme_allowlist.txt in the root directory of your code repository.The following allowlist file allows only theme repositories from the Acquia organization on github.com, the Open Framework repository on github.com, and the zen.git repository on drupal.org:
# Allow any github repos from the Acquia organization
github.com:acquia/*
# Allow specific github repo
github.com:SU-SWS/open_framework
# Allow the Zen theme from Drupal.org
git.drupal.org:project/zen.gitIf you don’t upload a allowlist file, or if the file does not contain any entries, Site Factory will not block any theme repositories from use.
To connect to an external Git repository containing one or more themes:
Return to the page in which you are entering your theme repository information, and then enter the following values for the Git repository you want to use:
[email protected]:repo.git)To ensure that the theme changes for one website do not affect other websites that use the same theme, Acquia recommends you to use discrete tags for all environments. However, it is worth noting that using branches for staged websites can speed your theme development process.
Site Factory compares theme repositories to entries in the allowlist file based on the following parameters:
user@ preceding the theme repository is ignored.github.com would match [email protected]:repo.git.If the allowlist file blocks a theme repository, Site Factory will display an error message and keep the previous theme repository settings.
If no error messages display, your Git repository themes will be checked out for use by your website. After the checkout completes, you can view the themes by signing in to the website and clicking Appearance in the admin menu.
There may be a delay between associating your Git theme repository with your website and the availability of its themes on the Appearance page. For example, delays can be more noticeable during updates or staging processes.
Whenever you make changes to your theme files, and commit those changes to the Git theme repository, you must update your websites’ theme files based on the correct branch or tag. You must update every website using the updated theme.
To refresh your theme on a single website:
post-theme-deploy hook script, as described in Performing custom actions after theme deployments, to clear the Twig cache after you deploy the updated theme.Site Factory obtains your new theme changes from the Git repository and adds them to your website. After it makes copies of the theme files, the theme changes display in the website’s Appearance page (and if the theme is in use, on the website itself).
You may see a delay between associating your Git theme repository with your website, and the availability of its themes on the Appearance page. For example, delays can be more noticeable during updates or staging processes.
You can use the post-theme-deploy Factory hook to clear Twig caches or perform other actions after deploying a theme. The post-theme-deploy Factory hook makes a set of arguments available to any script executed by the hook:
Sitegroup: Acquia’s hosting sitegroup/application.Environment: Acquia’s hosting environment, for example, 01live.Theme scope: Represents theme scope (currently the only possible value is site).Theme event Represents theme event (possible values: modify, delete).Domain: Represents (Acquia managed) domain name of the website. For example, in the URL mysite.demo.acsitefactory.com, the first part mysite represents the name that’s unique for each installed website.If you delete a website and recreate it with the same name, it get’s a different database role (unique identifier).
Using these arguments, you can create a script like the following example, which runs a Drush command to clear the Twig cache on the affected site on every server. Site Factory supplies the needed host, environment, and domain values:
#!/bin/bash
drush8 @$1.$2 --uri=$5 ev '\Drupal\Core\PhpStorage\PhpStorageFactory::get("twig")->deleteAll();'To deploy or update a theme for the current Drupal version from a remote repository:
ClearTwigCache, with content similar to the previous example. The script must be executable, as described in Executing your commands with a hook./factory-hooks/post-theme-deploy directory.If this content did not answer your questions, try searching or contacting our support team for further assistance.
During normal Drupal development, when you’re developing your website’s themes, best practices would have you store a theme’s files in the sites/all/themes directory under your docroot directory. If you want a design team to create and maintain your websites’ theme files without granting them access to your websites’ code, you can set up an external theme repository.
Site Factory allows you to configure a link to an external Git repository containing one or more themes for use with your Drupal website. After connecting your website to a Git repository containing one or more themes, the themes will display when you click Appearance in the admin menu.
When creating your external Git repository, ensure the repository contains the following items:
Cloud Platform requires deployment keys be associated with a user account. As GitHub does not support the use of the same deployment key for multiple repositories, create a Cloud Platform user as described in Deployment keys and Cloud Platform. Associate the key with a user account, instead of adding the SSH key as a deployment key.
To protect hosted websites from using themes containing potentially harmful settings or code, you can add a allowlist file of approved theme repositories to Site Factory. When administrative users try to add a theme repository, Site Factory compares the repository with the contents of the acsf_theme_allowlist.txt file.
To create an allowlist file for your theme repositories:
# ). The # isn’t used for allowlist filtering.* ) for wildcard entry.acsf_theme_allowlist.txt in the root directory of your code repository.The following allowlist file allows only theme repositories from the Acquia organization on github.com, the Open Framework repository on github.com, and the zen.git repository on drupal.org:
# Allow any github repos from the Acquia organization
github.com:acquia/*
# Allow specific github repo
github.com:SU-SWS/open_framework
# Allow the Zen theme from Drupal.org
git.drupal.org:project/zen.gitIf you don’t upload a allowlist file, or if the file does not contain any entries, Site Factory will not block any theme repositories from use.
To connect to an external Git repository containing one or more themes:
Return to the page in which you are entering your theme repository information, and then enter the following values for the Git repository you want to use:
[email protected]:repo.git)To ensure that the theme changes for one website do not affect other websites that use the same theme, Acquia recommends you to use discrete tags for all environments. However, it is worth noting that using branches for staged websites can speed your theme development process.
Site Factory compares theme repositories to entries in the allowlist file based on the following parameters:
user@ preceding the theme repository is ignored.github.com would match [email protected]:repo.git.If the allowlist file blocks a theme repository, Site Factory will display an error message and keep the previous theme repository settings.
If no error messages display, your Git repository themes will be checked out for use by your website. After the checkout completes, you can view the themes by signing in to the website and clicking Appearance in the admin menu.
There may be a delay between associating your Git theme repository with your website and the availability of its themes on the Appearance page. For example, delays can be more noticeable during updates or staging processes.
Whenever you make changes to your theme files, and commit those changes to the Git theme repository, you must update your websites’ theme files based on the correct branch or tag. You must update every website using the updated theme.
To refresh your theme on a single website:
post-theme-deploy hook script, as described in Performing custom actions after theme deployments, to clear the Twig cache after you deploy the updated theme.Site Factory obtains your new theme changes from the Git repository and adds them to your website. After it makes copies of the theme files, the theme changes display in the website’s Appearance page (and if the theme is in use, on the website itself).
You may see a delay between associating your Git theme repository with your website, and the availability of its themes on the Appearance page. For example, delays can be more noticeable during updates or staging processes.
You can use the post-theme-deploy Factory hook to clear Twig caches or perform other actions after deploying a theme. The post-theme-deploy Factory hook makes a set of arguments available to any script executed by the hook:
Sitegroup: Acquia’s hosting sitegroup/application.Environment: Acquia’s hosting environment, for example, 01live.Theme scope: Represents theme scope (currently the only possible value is site).Theme event Represents theme event (possible values: modify, delete).Domain: Represents (Acquia managed) domain name of the website. For example, in the URL mysite.demo.acsitefactory.com, the first part mysite represents the name that’s unique for each installed website.If you delete a website and recreate it with the same name, it get’s a different database role (unique identifier).
Using these arguments, you can create a script like the following example, which runs a Drush command to clear the Twig cache on the affected site on every server. Site Factory supplies the needed host, environment, and domain values:
#!/bin/bash
drush8 @$1.$2 --uri=$5 ev '\Drupal\Core\PhpStorage\PhpStorageFactory::get("twig")->deleteAll();'To deploy or update a theme for the current Drupal version from a remote repository:
ClearTwigCache, with content similar to the previous example. The script must be executable, as described in Executing your commands with a hook./factory-hooks/post-theme-deploy directory.If this content did not answer your questions, try searching or contacting our support team for further assistance.