aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mass_image_import.module66
1 files changed, 33 insertions, 33 deletions
diff --git a/mass_image_import.module b/mass_image_import.module
index dfc2f48..5fe82e5 100644
--- a/mass_image_import.module
+++ b/mass_image_import.module
@@ -134,6 +134,27 @@ function mass_image_import_batch($type, &$context) {
}
/**
+ * Callback for image import.
+ */
+function mass_image_import_batch_finished($success, $results, $operations) {
+ if ($success) {
+ if (count($results) > 0) {
+ $message = format_plural(count($results), t('One image processed.'), t('@count images processed.'));
+ }
+ else {
+ $message = t('No images to import.');
+ }
+ }
+ else {
+ $message = t('Finished with an error.');
+ }
+
+ // Log.
+ watchdog('image', 'Finished mass image import.');
+ drupal_set_message($message);
+}
+
+/**
* Make a list of image files.
*
* @return
@@ -219,24 +240,20 @@ function mass_image_import_file($file, $type = 'image') {
}
/**
- * Callback for image import.
+ * Get the first filefield from a content type.
+ *
+ * @param $fields
+ * Content type fields.
+ *
+ * @return
+ * Field name.
*/
-function mass_image_import_batch_finished($success, $results, $operations) {
- if ($success) {
- if (count($results) > 0) {
- $message = format_plural(count($results), t('One image processed.'), t('@count images processed.'));
- }
- else {
- $message = t('No images to import.');
+function mass_image_import_field($fields) {
+ foreach ($fields as $field) {
+ if ($field['type'] == 'filefield') {
+ return $field['field_name'];
}
- }
- else {
- $message = t('Finished with an error.');
- }
-
- // Log.
- watchdog('image', 'Finished mass image import.');
- drupal_set_message($message);
+ }
}
/**
@@ -289,20 +306,3 @@ function mass_image_import_create_node_from($filepath, $title, $body, $type) {
drupal_execute($type .'_node_form', $form_state, $node);
return $node;
}
-
-/**
- * Get the first filefield from a content type.
- *
- * @param $fields
- * Content type fields.
- *
- * @return
- * Field name.
- */
-function mass_image_import_field($fields) {
- foreach ($fields as $field) {
- if ($field['type'] == 'filefield') {
- return $field['field_name'];
- }
- }
-}