diff --git a/wysiwyg.install b/wysiwyg.install index 038ba46..426c4c5 100644 --- a/wysiwyg.install +++ b/wysiwyg.install @@ -30,6 +30,22 @@ function wysiwyg_schema() { 'description' => 'Configuration settings for the editor.', 'type' => 'text', 'size' => 'normal', + 'serialize' => TRUE, + ), + 'status' => array( + 'type' => 'int', + 'not null' => TRUE, + // Hard code the value of ENTITY_CUSTOM in case entity.module is not present. + 'default' => 0x01, + 'size' => 'tiny', + 'description' => 'The exportable status of the entity.', + ), + 'module' => array( + 'description' => 'The name of the providing module if the entity has been defined in code.', + 'type' => 'varchar', + 'length' => 255, + 'default' => '', + 'not null' => FALSE, ), ), 'primary key' => array('format'), @@ -310,3 +326,26 @@ function wysiwyg_update_7200() { )); } } + +/** + * Add fields used for Entity API module exportables. + */ +function wysiwyg_update_7201() { + // Create a created column. + db_add_field('wysiwyg', 'status', array( + 'type' => 'int', + 'not null' => TRUE, + // Hard code the value of ENTITY_CUSTOM in case entity.module is not present. + 'default' => 0x01, + 'size' => 'tiny', + 'description' => 'The exportable status of the entity.', + )); + + db_add_field('wysiwyg', 'module', array( + 'description' => 'The name of the providing module if the entity has been defined in code.', + 'type' => 'varchar', + 'length' => 255, + 'default' => '', + 'not null' => FALSE, + )); +} diff --git a/wysiwyg.module b/wysiwyg.module index 771cbd7..e76f6d2 100644 --- a/wysiwyg.module +++ b/wysiwyg.module @@ -12,14 +12,19 @@ function wysiwyg_entity_info() { $types['wysiwyg_profile'] = array( 'label' => t('Wysiwyg profile'), 'base table' => 'wysiwyg', - 'controller class' => 'WysiwygProfileController', + 'controller class' => module_exists('entity') ? 'EntityAPIController' : 'WysiwygProfileController', 'fieldable' => FALSE, // When loading all entities, DrupalDefaultEntityController::load() ignores // its static cache. Therefore, wysiwyg_profile_load_all() implements a // custom static cache. 'static cache' => FALSE, + // Make exportable if the Entity API module is enabled. + 'exportable' => TRUE, + 'module' => 'wysiwyg', 'entity keys' => array( 'id' => 'format', + // Provides the label in e.g. features export. + 'label' => 'format', ), ); return $types;