Target audience: Drupal project maintainers.
On Drupal project pages you might find a 'Try a demonstration' link to evaluate it. A good project demo is one where you can fiddle with the settings and for this you need to provide admin access in a temporary sandbox. This is where simplytest.me comes in handy by allowing anyone to create a temporary Drupal website with any module, theme or distribution.
Simplytest.me creates a temporary sandbox site with a choosen project enabled. In a demo you might want some sample content, need an API key to be set or another module to be enabled. This page will describe different methods to provide example content for your demo on simplytest.me.
#Presetting the submission fields
To make it easy to use as demo site, you can manipulate the submission settings by URL parameters. By doing this a person clicking on the demo-link from your projects page only has to hit the "Launch sandbox" button on simplytest.me.
Specifying the project (the newest available version will be selected):
Setting a specific version:
#Providing demo content
#By a sub-module (recommended)
The easiest way to enrich a demo with example content is by creating a demo submodule (eg. a feature module).
While Drupal will ignore it when installing the main module, people can enable it to get an example configuration of your project. This is also useful for people testing a project locally and a recommended best practice.
You can make sure that your demo module is always enabled on simplytest.me by specifying it in your themes or modules .info file:
simplytest_dependencies = demo_module
#By patching the project
The direct URL to preset a project on simplytest.me can be appended with additional modules to download, but also with patches to apply on the main project. Apart for the testing of patches in general, it can be used to modify a module's files for the purpose of making a demo. This patch will only be used when deploying a demo site on simplytest.me and will never be committed to the project itself.
Only patches that live on drupal.org can be used. You have to open an issue for your module with a feature request like 'Provide a demo with admin access'. You can then upload your patch as usual. An example: https://drupal.org/node/2043135.
For every patch you want to apply on a project you have to add the
patch= query to your demo-link, to set the patch to be applied when launching the sandbox:
If you already have a submodule for your demo content, the easiest way to use a patch is by adding a dependency to the the main projects .info file for your demo-submodule. When simplytest.me installs the main module, Drupal will now enable the demo module too.
#By creating a demo distribution
This is the only method that shows you the installation screens prior to be operative, because it is a distribution. It does not differ from the development of a normal Distribution.
If you develop a distro to serve as a demo, it is wise to start with a copy of the 'profiles/standard' folder. At least you know you can rely on the availability of things such as the content type Article and Basic page when adding your code.
A working example of a distribution to showcase a combination of modules: http://simplytest.me/project/demo_flickr/7.x-1.x
#Adding the demo-link to your page
After implementing one of above methods, edit your project page. Under 'Project resources' in the field 'Demo site' paste the direct URL to use on simplytest.me.
#Using code to provide demo content
Using one of the above methods you can mostly make use of the features module to initialize your demo configuration. But you can also use simple code snippets to..
Create sample nodes
Define the $node object, such as the content type, if it is promoted, a title, a body, etcetera. Conclude with
node_save($node);. It is wise to create an item 'Sample page' in the main menu using
Enable other modules
Additional modules can be added by simplytest.me but are not enabled by default. If needed they can be activated by your install hook.
// Enable the popup module. module_enable(array('popup'), 'FALSE');
Admin quick links
To avoid having to go through long lists of items in the admin menu to search for the relevant settings, it is useful to have some relevant quick links to the module configuration in the navigation menu.
$item = array( 'link_title' => st('Popup settings'), 'link_path' =>'admin/config/user-interface/popup', ); menu_link_save($item);
Most settings do have a default value, but some might require a value to be provided, like an API key.
It is good practice to define an uninstall hook to undo the changes made. It will save you time when testing the modified install file on the development site, as you probably have to install and uninstall it many times.