Site preview and static site generator from Drupal
Zariz is a suite of Drupal modules and methodology, that models content (nodes)
creation and editing similar to Git’s branches, and allows generating static
sites from the Drupal backend.
/live/user
and login (user: admin pass: admin)admin/content/migrate
and migate the contentThe OG (Organic groups) group type Branch
is equivalent to a Git branch.
// Create a new "master" branch. There can be only a single master on the site.
$live_node = zariz_create_branch('live');
// Branch out fom the live branch.
$dev_node = zariz_create_branch('dev', $live_node);
We can check if there are merge conflicts - meaning that there is already a newer
content in the “to branch”. Zariz will auto-detect the parent branch.
$conflicts = zariz_get_merge_conflicts($dev_node->nid);
If there are no conflicts, we can merge - meaning that content from the “from
branch” will be cloned into the “to branch”.
$snapshot = zariz_merge_branch($dev_node->nid);
Snapshots holds information about the content of a branch at a certain time.
This is done by simply holding the last entity ID (e.g. node) that existed. The last entity ID can keep changing as long as the snapshot is not locked.
// Get the last snapshot from a branch.
$snapshot = zariz_get_snapshot_from_branch($live_node->nid);
// Check if a snapshot is locked.
$snpashot->isLocked()
// Lock a snpashot.
$snpashot->lock()
Zariz can alter a query to the node table, to reflect the content in a certain branch.
The altering is opt-in, by settings the zariz
query tag. For example:
$query = new EntityFieldQuery();
$result = $query
->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'article')
// Set the Zariz query tag.
->addTag('zariz')
// Set explicitly the Branch ID. If this Metadata is omitted, the
// OG-context will be used.
->addMetaData('zariz', array('branch_id' => $branch_id))
->propertyOrderBy('nid')
->execute();
The same query tag can be also used in Views. For example in /admin/structure/views/view/branch_content/edit
under Query settings
=> Query Tags
notice that the zariz
tag was added.
“Zariz commerce” module integrates with commerce and allows smart revisioning
of commerce products.
admin/people/permissions
grant authenticated user Branch: Create new content
admin/config/group/permissions/node/branch
grant non-member and member roles the following permissions:Merge branch
Create Article content
Edit any Article content
Enable zariz_example
module and follow its README
Here is the Drush command to download and install Zariz Example:
drush dl entityreference_prepopulate replicate node_clone
drush dl og --dev
drush en zariz_example
It is possible (and optional) to export Zariz sites in a scalable manner using generator-zariz.
Developed by Gizra