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. You can read more about it in this blog post, and here.
The counterpart of Zariz which is responsible for the static site creation is generator-zariz.
- Use this simplytest.me link (the "Zariz example" module will be auto enabled)
- Migrate content via
/admin/content/migrate
The 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.
Unless stated otherwise, use latest release version is required.
- Entity reference prepopualte
- Organic groups (Dev version until this bug in Drupal.org release managment is fixed)
- Replicate
- Node clone
"Zariz commerce" module integrates with commerce and allows smart revisioning of commerce products. Optional: In order to be able to "Add to cart" from the reference field, this soon-to-be merged patch is needed.
- In
admin/people/permissions
grant authenticated userBranch: Create new content
- In
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
Developed by Gizra