Experimental project
This is a sandbox project, which contains experimental code for developer use only.
This project developed with Drupal 7 make it very easy to import/export content and taxonomy
It allows you to:
- Import a CSV list of content into Drupal through an existing type of content
- Import a nested XML into a vocabulary (a specific type of structure is required)
- Export a type of content into a CVS list
- Export one or several vocabularies into XML files, all the hierarchy of terms will be kept
Knowing Feeds module, the difference with Easy import is primary it's simplicity of use.
Almost any type of CSV files can be easily imported to a Drupal 7 content type formated in ANSI, UTF-8 or HTML.
Here is a list of all field type handles with this module
Reverse process to export content into a CSV of the same format is taken in charge.
One more tool is the ability to import and export a nested taxonomy, this function works well but only handles basic functionality for the moment, it also answer to a need that I couldn't find in other existing modules in Drupal 7.
Below, you'll find a list of all field types supported
- text_with_summary
- text_long'
- number_integer
- number_float
- number_decimal
- text
- datetime
- datestamp
- date
- list_boolean
- list_integer
- list_float
- list_text
- link_field
- node_reference (You can refer to any type of field to any content type)
- image and file (They must be uploaded first to your public:// or private:// directory, depend on which you set as default)
- taxonomy_term_reference (Handles also taxonomy depth if you have
- OG group audience (You can affect directly your node to a group)
- entityreference (For now only taxonomy_term and node with the same behaviour that node_reference and taxonomy_term)
Not to mention title, alias, create and changed value of a node
If you wish to import nodes programatically, you can also use EasyimportNodeContent class
Example:
include_once (drupal_get_path('module', 'easyimport') . '/easyimport.nodecontent.inc');
$node = new EasyimportNodeContent('employee', $title);
$nid = db_select('node', 'n')->fields('n', array('nid'))->condition('title', $title)->execute()->fetchField();
if ($nid) {
$node->load($nid);
}
$adresse = array(
'name' => 'Robert Smith',
'street' => 'Rue Candolle 5',
'city' => 'Geneva',
'province' => 'Geneva',
'postal_code' => 1204,
'country' => 'ch',
);
$node->addText('field_name', 'Smith');
$node->addText('field_lastname', 'Robert');
$node->addSelect('field_gender', 1, 'is_numeric');
$node->addLocation('field_adresse', $adresse);
// This will add to main category "Science&IT" & subcategory "IT Manager"
$node->addTermReference('field_employment', array('Science&IT', 'IT Manager'));
$node->addNodeReference('field_company', 'field_company_name', 'Yahoo');
$node->save();
Project information
- Created by lahode on , updated