diff --git a/includes/mime_type.autocomplete.inc b/includes/mime_type.autocomplete.inc new file mode 100644 index 00000000..3ac31079 --- /dev/null +++ b/includes/mime_type.autocomplete.inc @@ -0,0 +1,27 @@ +getMimeTypes(); + $output = array(); + foreach ($mime_types as $mime_type) { + if (preg_match("/{$string}/i", $mime_type) !== 0) { + $output[$mime_type] = $mime_type; + } + } + return drupal_json_output($output); +} diff --git a/islandora.module b/islandora.module index 8e480baa..99a5740b 100644 --- a/islandora.module +++ b/islandora.module @@ -62,6 +62,7 @@ define('ISLANDORA_DERVIATIVE_CREATION_HOOK', 'islandora_derivative'); // Autocomplete paths. define('ISLANDORA_CONTENT_MODELS_AUTOCOMPLETE', 'islandora/autocomplete/content-models'); +define('ISLANDORA_MIME_TYPES_AUTOCOMPLETE', 'islandora/autocomplete/mime-types'); /** * @deprecated Constants. @@ -358,6 +359,15 @@ function islandora_menu() { 'access arguments' => array('administer site configuration'), 'type' => MENU_CALLBACK, ); + $items[ISLANDORA_MIME_TYPES_AUTOCOMPLETE] = array( + 'title' => 'Autocomplete callback', + 'description' => 'Autocomplete MIME Types.', + 'file' => 'includes/mime_type.autocomplete.inc', + 'page callback' => 'islandora_mime_type_autocomplete', + 'page arguments' => array(3), + 'access arguments' => array('administer site configuration'), + 'type' => MENU_CALLBACK, + ); $items['admin/islandora/restore/prep'] = array( 'description' => 'Restore or permanantly remove objects with Deleted status', 'title' => 'Manage Deleted Objects',