SUMMARY
-------
Entity Share is a module allowing you to share some content entities
like node, field_collection, taxonomy, medias etc between different
Drupal instances.
HOW DOES IT WORK
----------------
The principle of this module is to generate some export from one instance
and to send this exported datas to a remote Drupal using a server that
will import the datas.
The limitation there is that you MUST have exactly the same content types,
field_collections, taxonomy vocabularies between all your instances.
This module manage the export of contents, not of structures
(you can use features module to synchronise your structure for example).
INSTALLATION
------------
1. Place this module directory in your modules folder
(this will usually be "sites/all/modules").
2. Go to "Administer" -> "Site building" -> "Modules" and enable the module.
REQUIREMENTS
------------
- UUID (https://www.drupal.org/project/uuid)
- Entity API (https://www.drupal.org/project/entity)
CONFIGURATION
-------------
Install entity_share_ui module
USAGE
-----
If you want to use the EntityShare with Graphic Interface,
then you should use entity_share_ui_client module.
If you just want to use the EntityShare API,
you can use the following main classes:
* EntityShareEntityExport
* EntityShareEntityImport
* EntityShareClient
Example of code to share content:
<?php
$node_id = 69;
$node = node_load($node_id);
// Export nid 69.
// We clone the node to not alter the original node object if needed after.
$export = new EntityShareEntityExport(clone $node);
// Get the node exported object, basically it's the original node
// with some sub entities loaded and some datas added for export.
$exported_node = $export->execute();
// Share the nid 69 to myendpoint.
$endpoint = 'http://myendpoint/entity_share/rest_api';
$client = new EntityShareClient($endpoint);
// Login used by entity share that must have the rights needed
// administer nodes, access entityshare server etc.
$client->login('myremotelogin', 'mypassword');
$response = $client->create('node', drupal_json_encode($exported_node));
// You get a response object containing the HTTP code of the response,
// and the json result of you export in $response->data.
if ($response->code == '200') {
$result = drupal_json_decode($response->data);
if ($result['status'] == 'OK') {
// Success.
print_r($result['result']);
}
else {
// Fail.
print_r($result['error']);
}
}
MAINTAINERS
-----------
Current maintainers:
* Thomas Bernard (ithom) - https://www.drupal.org/user/3175403
* Florent Torregrosa (Grimreaper) - https://www.drupal.org/user/2388214
This project has been sponsored by:
* Smile - http://www.smile.fr
View source
-
- SUMMARY
- -------
-
- Entity Share is a module allowing you to share some content entities
- like node, field_collection, taxonomy, medias etc between different
- Drupal instances.
-
- HOW DOES IT WORK
- ----------------
-
- The principle of this module is to generate some export from one instance
- and to send this exported datas to a remote Drupal using a server that
- will import the datas.
-
- The limitation there is that you MUST have exactly the same content types,
- field_collections, taxonomy vocabularies between all your instances.
- This module manage the export of contents, not of structures
- (you can use features module to synchronise your structure for example).
-
- INSTALLATION
- ------------
-
- 1. Place this module directory in your modules folder
- (this will usually be "sites/all/modules").
- 2. Go to "Administer" -> "Site building" -> "Modules" and enable the module.
-
- REQUIREMENTS
- ------------
-
- - UUID (https://www.drupal.org/project/uuid)
- - Entity API (https://www.drupal.org/project/entity)
-
- CONFIGURATION
- -------------
-
- Install entity_share_ui module
-
- USAGE
- -----
-
- If you want to use the EntityShare with Graphic Interface,
- then you should use entity_share_ui_client module.
-
- If you just want to use the EntityShare API,
- you can use the following main classes:
-
- * EntityShareEntityExport
- * EntityShareEntityImport
- * EntityShareClient
-
- Example of code to share content:
- $node_id = 69;
- $node = node_load($node_id);
-
- // Export nid 69.
- // We clone the node to not alter the original node object if needed after.
- $export = new EntityShareEntityExport(clone $node);
-
- // Get the node exported object, basically it's the original node
- // with some sub entities loaded and some datas added for export.
- $exported_node = $export->execute();
-
-
- // Share the nid 69 to myendpoint.
- $endpoint = 'http://myendpoint/entity_share/rest_api';
-
- $client = new EntityShareClient($endpoint);
- // Login used by entity share that must have the rights needed
- // administer nodes, access entityshare server etc.
- $client->login('myremotelogin', 'mypassword');
-
- $response = $client->create('node', drupal_json_encode($exported_node));
- // You get a response object containing the HTTP code of the response,
- // and the json result of you export in $response->data.
- if ($response->code == '200') {
- $result = drupal_json_decode($response->data);
- if ($result['status'] == 'OK') {
- // Success.
- print_r($result['result']);
- }
- else {
- // Fail.
- print_r($result['error']);
- }
- }
-
- MAINTAINERS
- -----------
-
- Current maintainers:
- * Thomas Bernard (ithom) - https://www.drupal.org/user/3175403
- * Florent Torregrosa (Grimreaper) - https://www.drupal.org/user/2388214
-
- This project has been sponsored by:
- * Smile - http://www.smile.fr