diff options
author | Silvio <silvio@devlet.com.br> | 2010-10-08 18:17:12 -0300 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2010-10-08 18:17:12 -0300 |
commit | dd0ce4f6c3dd51790567f912e529ef0d66cf1144 (patch) | |
tree | 5d81ed8950198d9132036154fa394708c6cbd9ef | |
parent | a02c5743d59e8768dc66f1e4a664f7b8470ae8a2 (diff) | |
download | mass_image_import-dd0ce4f6c3dd51790567f912e529ef0d66cf1144.tar.gz mass_image_import-dd0ce4f6c3dd51790567f912e529ef0d66cf1144.tar.bz2 |
Adding mass_image_import_types()
-rw-r--r-- | mass_image_import.module | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/mass_image_import.module b/mass_image_import.module index 54edacf..858fe0b 100644 --- a/mass_image_import.module +++ b/mass_image_import.module @@ -42,19 +42,12 @@ function mass_image_import() { * Mass import form. */ function mass_image_import_form(&$form_state) { - $node_types = node_get_types(); - $node_codes = array(); - - foreach ($node_types as $item) { - $node_codes[$item->type] = $item->name; - } - $form['node_type'] = array( '#type' => 'select', '#title' => t('Node type'), - '#options' => $node_codes, - '#default_value' => variable_get('mass_image_import_nodetype', array()), - '#description' => t('Select node type to import images. In case the node type contains more than one filefield, make sure that the imagefield is the first one.'), + '#options' => mass_image_import_types(), + '#default_value' => variable_get('mass_image_import_node_type', array()), + '#description' => t('Select node type to import images. For CCK, if node type contains more than one filefield, make sure that the imagefield is the first one.'), ); $form['submit'] = array( @@ -66,6 +59,23 @@ function mass_image_import_form(&$form_state) { } /** + * Return the existing content types. + * + * @return + * Content types. + */ +function mass_image_import_types() { + $node_types = node_get_types(); + $node_codes = array(); + + foreach ($node_types as $item) { + $node_codes[$item->type] = $item->name; + } + + return $node_codes; +} + +/** * Handle post-validation form-submission. * * @todo @@ -73,10 +83,10 @@ function mass_image_import_form(&$form_state) { */ function mass_image_import_form_submit($form, &$form_state) { // Save form input. - variable_set('node_truncate_node_type', $type); + $type = $form_state['values']['node_type']; + variable_set('mass_image_import_node_type', $type); // Setup batch configuration - $type = $form_state['values']['node_type']; $batch = array( 'title' => t('Importing images'), 'operations' => array(array('mass_image_import_batch', array($type))), |