diff --git a/help/export.html b/help/export.html
index 9118e72..663f09f 100644
--- a/help/export.html
+++ b/help/export.html
@@ -122,6 +122,9 @@ function mymodule_schema() {
bulk export
Declares whether or not the exportable will be available for bulk exporting.
+export type string
+The export type string (Local, Overridden, Database) is normally stored as $item->type. Since type is a very common keyword, it's possible to specify what key to actually use.
+
list callback
Bulk export callback to provide a list of exportable objects to be chosen for bulk exporting. Defaults to $module . '_' . $table . '_list' if the function exists. If it is not, a default listing function will be provided that will make a best effort to list the titles. See ctools_export_default_list().
@@ -189,6 +192,7 @@ Exportable objects have several reserved keys that are used by the CTools export
Overridden is an object that lives in the database and is overriding the exported configuration of a corresponding object in code.
Default is an object that lives only in code.
+Note: This key can be changed by setting 'export type string' to something else, to try and prevent "type" from conflicting.
diff --git a/includes/export.inc b/includes/export.inc
index fd6797a..c092527 100644
--- a/includes/export.inc
+++ b/includes/export.inc
@@ -260,7 +260,7 @@ function ctools_export_crud_import($table, $code) {
// Set these defaults just the same way that ctools_export_new_object sets
// them.
$item->export_type = NULL;
- $item->type = t('Local');
+ $item->{$export['export type string']} = t('Local');
return $item;
}
@@ -382,7 +382,7 @@ function ctools_export_load_object($table, $type = 'all', $args = array()) {
while ($data = db_fetch_object($result)) {
$object = _ctools_export_unpack_object($schema, $data, $export['object']);
$object->table = $table;
- $object->type = t('Normal');
+ $object->{$export['export type string']} = t('Normal');
$object->export_type = EXPORT_IN_DATABASE;
// Determine if default object is enabled or disabled.
if (isset($status[$object->{$export['key']}])) {
@@ -423,14 +423,14 @@ function ctools_export_load_object($table, $type = 'all', $args = array()) {
}
if (!empty($cache[$table][$object->{$export['key']}])) {
- $cache[$table][$object->{$export['key']}]->type = t('Overridden');
+ $cache[$table][$object->{$export['key']}]->{$export['export type string']} = t('Overridden');
$cache[$table][$object->{$export['key']}]->export_type |= EXPORT_IN_CODE;
if ($type == 'conditions') {
$return[$object->{$export['key']}] = $cache[$table][$object->{$export['key']}];
}
}
else {
- $object->type = t('Default');
+ $object->{$export['export type string']} = t('Default');
$object->export_type = EXPORT_IN_CODE;
$object->in_code_only = TRUE;
$object->table = $table;
@@ -520,7 +520,7 @@ function ctools_get_default_object($table, $name) {
$object->disabled = $status[$object->{$export['key']}];
}
- $object->type = t('Default');
+ $object->{$export['export type string']} = t('Default');
$object->export_type = EXPORT_IN_CODE;
$object->in_code_only = TRUE;
@@ -772,6 +772,7 @@ function ctools_export_get_schema($table) {
'bulk export' => TRUE,
'list callback' => "$schema[module]_{$table}_list",
'to hook code callback' => "$schema[module]_{$table}_to_hook_code",
+ 'export type string' => 'type',
);
// If the export definition doesn't have the "primary key" then the CRUD
@@ -923,7 +924,7 @@ function ctools_export_new_object($table, $set_defaults = TRUE) {
// We don't set the export_type property here, as this object is not saved
// yet. We do give it NULL so we don't generate notices trying to read it.
$object->export_type = NULL;
- $object->type = t('Local');
+ $object->{$export['export type string']} = t('Local');
}
return $object;
}
diff --git a/plugins/export_ui/ctools_export_ui.class.php b/plugins/export_ui/ctools_export_ui.class.php
index 2e1acb6..7496299 100644
--- a/plugins/export_ui/ctools_export_ui.class.php
+++ b/plugins/export_ui/ctools_export_ui.class.php
@@ -341,6 +341,7 @@ class ctools_export_ui {
function list_form_submit(&$form, &$form_state) {
// Filter and re-sort the pages.
$plugin = $this->plugin;
+ $schema = ctools_export_get_schema($this->plugin['schema']);
$prefix = ctools_export_ui_plugin_base_path($plugin);
@@ -356,10 +357,10 @@ class ctools_export_ui {
$allowed_operations = drupal_map_assoc(array_keys($plugin['allowed operations']));
$not_allowed_operations = array('import');
- if ($item->type == t('Normal')) {
+ if ($item->{$schema['export']['export type string']} == t('Normal')) {
$not_allowed_operations[] = 'revert';
}
- elseif ($item->type == t('Overridden')) {
+ elseif ($item->{$schema['export']['export type string']} == t('Overridden')) {
$not_allowed_operations[] = 'delete';
}
else {
@@ -421,7 +422,8 @@ class ctools_export_ui {
* TRUE if the item should be excluded.
*/
function list_filter($form_state, $item) {
- if ($form_state['values']['storage'] != 'all' && $form_state['values']['storage'] != $item->type) {
+ $schema = ctools_export_get_schema($this->plugin['schema']);
+ if ($form_state['values']['storage'] != 'all' && $form_state['values']['storage'] != $item->{$schema['export']['export type string']}) {
return TRUE;
}
@@ -510,8 +512,9 @@ class ctools_export_ui {
function list_build_row($item, &$form_state, $operations) {
// Set up sorting
$name = $item->{$this->plugin['export']['key']};
+ $schema = ctools_export_get_schema($this->plugin['schema']);
- // Note: $item->type should have already been set up by export.inc so
+ // Note: $item->{$schema['export']['export type string']} should have already been set up by export.inc so
// we can use it safely.
switch ($form_state['values']['order']) {
case 'disabled':
@@ -524,7 +527,7 @@ class ctools_export_ui {
$this->sorts[$name] = $name;
break;
case 'storage':
- $this->sorts[$name] = $item->type . $name;
+ $this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
break;
}
@@ -536,7 +539,7 @@ class ctools_export_ui {
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$this->plugin['export']['admin_title']}), 'class' => 'ctools-export-ui-title');
}
$this->rows[$name]['data'][] = array('data' => check_plain($name), 'class' => 'ctools-export-ui-name');
- $this->rows[$name]['data'][] = array('data' => check_plain($item->type), 'class' => 'ctools-export-ui-storage');
+ $this->rows[$name]['data'][] = array('data' => check_plain($item->{$schema['export']['export type string']}), 'class' => 'ctools-export-ui-storage');
$this->rows[$name]['data'][] = array('data' => theme('links', $operations), 'class' => 'ctools-export-ui-operations');
// Add an automatic mouseover of the description if one exists.