diff --git a/file_entity.admin.inc b/file_entity.admin.inc index 4b40f93..ba99ae7 100644 --- a/file_entity.admin.inc +++ b/file_entity.admin.inc @@ -352,7 +352,13 @@ function theme_file_entity_file_display_order($variables) { } /** - * Admin screen for file type settings. + * Form constructor for the file type settings form. + * + * @param object $type + * The file type. + * + * @see file_entity_file_type_form_validate() + * @see file_entity_file_type_form_submit() */ function file_entity_file_type_form($form, &$form_state, $type) { $form['#file_type'] = $type->type; @@ -420,7 +426,9 @@ function file_entity_file_type_form($form, &$form_state, $type) { } /** - * Validation handler for file type settings form. + * Form validation handler for file_entity_file_type_form(). + * + * @see file_entity_file_type_form_submit() */ function file_entity_file_type_form_validate($form, &$form_state) { include_once DRUPAL_ROOT . '/includes/file.mimetypes.inc'; @@ -436,7 +444,9 @@ function file_entity_file_type_form_validate($form, &$form_state) { } /** - * Submit handler for file type settings form. + * Form submission handler for file_entity_file_type_form(). + * + * @see file_entity_file_type_form_validate() */ function file_entity_file_type_form_submit($form, &$form_state) { $type = file_type_load($form['#file_type']); diff --git a/file_entity.api.php b/file_entity.api.php index 8c05f58..a881ece 100644 --- a/file_entity.api.php +++ b/file_entity.api.php @@ -6,20 +6,32 @@ */ /** - * Defines default file types. + * Declare that your module provides default file types. + * + * Your module may already implement this hook for other CTools plugin types. + * If so, copy the body of this function into the existing hook. + */ +function hook_ctools_plugin_api($owner, $api) { + if ($owner == 'file_entity' && $api == 'file_type') { + return array('version' => 1); + } +} + +/** + * Define default file types. * * File types are implemented as CTools exportables, so modules can alter the * defaults via hook_file_default_types_alter(), and the administrator can * save overridden and custom types to the {file_type} database table. * - * @return - * An array whose keys are file type names and whose values are arrays - * describing the file type, with the following key/value pairs: + * @return array + * An array whose keys are file type names and whose values are objects + * representing the file type, with the following key/value pairs: * - api_version: The version of this data. * - type: The file type name. * - label: The human-readable name of the file type. * - description: The description of this file type. - * - mimetpes: An array of mimetypes that this file type will map to. + * - mimetypes: An array of mimetypes that this file type will map to. */ function hook_file_default_types() { return array( @@ -38,7 +50,7 @@ function hook_file_default_types() { } /** - * Performs alterations on default file types. + * Alter default file types. * * @see hook_file_default_types() */ diff --git a/file_entity.module b/file_entity.module index a16189b..042c9f6 100644 --- a/file_entity.module +++ b/file_entity.module @@ -885,13 +885,8 @@ function file_entity_get_hidden_stream_wrappers() { * Implements hook_ctools_plugin_api(). */ function file_entity_ctools_plugin_api($owner, $api) { - static $api_versions = array( - 'file_entity' => array( - 'file_type' => 1, - ), - ); - if (isset($api_versions[$owner][$api])) { - return array('version' => $api_versions[$owner][$api]); + if ($owner == 'file_entity' && $api == 'file_type') { + return array('version' => 1); } } @@ -901,12 +896,12 @@ function file_entity_ctools_plugin_api($owner, $api) { function file_entity_file_default_types() { $types = array(); - // Image + // Image. $types['image'] = (object) array( 'api_version' => 1, 'type' => 'image', 'label' => t('Image'), - 'description' => t("An Image is a two-dimensional picture that has a similar appearance to some subject, usually a physical object or a person."), + 'description' => t('An Image file is a still visual.'), 'mimetypes' => array( 'image/jpeg', 'image/gif', @@ -917,12 +912,12 @@ function file_entity_file_default_types() { ), ); - // Video + // Video. $types['video'] = (object) array( 'api_version' => 1, 'type' => 'video', 'label' => t('Video'), - 'description' => t('Videos are a sequence of still images representing scenes in motion.'), + 'description' => t('A Video file is a moving visual recording.'), 'mimetypes' => array( 'video/quicktime', 'video/mp4', @@ -934,12 +929,12 @@ function file_entity_file_default_types() { ), ); - // Audio + // Audio. $types['audio'] = (object) array( 'api_version' => 1, 'type' => 'audio', 'label' => t('Audio'), - 'description' => t('Audio files are an electrical representation of sound.'), + 'description' => t('An Audio file is a sound recording.'), 'mimetypes' => array( 'audio/mpeg', 'audio/x-ms-wma', @@ -951,12 +946,12 @@ function file_entity_file_default_types() { ), ); - // Document + // Document. $types['document'] = (object) array( 'api_version' => 1, 'type' => 'document', 'label' => t('Document'), - 'description' => t('A Document is a work of writing intended to store and communicate information.'), + 'description' => t('A Document file is written information.'), 'mimetypes' => array( 'text/plain', 'application/msword',