function _taxonomy_csv_info_vocabulary in Taxonomy CSV import/export 7.5
Same name and namespace in other branches
- 6.5 import/taxonomy_csv.import.result.inc \_taxonomy_csv_info_vocabulary()
- 6.2 import/taxonomy_csv.import.result.inc \_taxonomy_csv_info_vocabulary()
- 6.3 import/taxonomy_csv.import.result.inc \_taxonomy_csv_info_vocabulary()
- 6.4 import/taxonomy_csv.import.result.inc \_taxonomy_csv_info_vocabulary()
- 7.4 import/taxonomy_csv.import.result.inc \_taxonomy_csv_info_vocabulary()
Check created vocabularies and return formatted info on them.
1 call to _taxonomy_csv_info_vocabulary()
- _taxonomy_csv_import_result in import/
taxonomy_csv.import.result.inc - Display result messages of import process.
File
- import/
taxonomy_csv.import.result.inc, line 127 - Show export result messages.
Code
function _taxonomy_csv_info_vocabulary($options) {
$messages = array();
// General info on used or created vocabularies.
$vocabularies = array(
$options['vocabulary_id'],
);
$messages[] = t('%count used or created.', array(
'%count' => format_plural(count($vocabularies), 'A vocabulary has been', '@count vocabularies have been', array()),
));
foreach ($vocabularies as $vocabulary_id) {
$message = '';
// Check or update hierarchy of vocabularies.
$vocabulary = taxonomy_vocabulary_load($vocabulary_id);
if ($options['check_hierarchy']) {
$result = taxonomy_check_vocabulary_hierarchy($vocabulary, array(
'tid' => 0,
));
}
else {
if ($options['set_hierarchy'] != $vocabulary->hierarchy) {
$vocabulary->hierarchy = $options['set_hierarchy'];
$result = taxonomy_vocabulary_save($vocabulary);
}
$result = $options['set_hierarchy'];
}
$new_hierarchy[$vocabulary_id] = $result;
// Display general info about vocabulary.
$message .= _taxonomy_csv_info_vocabulary_destination($vocabulary, $options['vocabulary_target']);
$message .= '<br />';
if (isset($vocabulary->language) && module_exists('i18n_taxonomy')) {
$message .= t('Language of vocabulary: "!language".', array(
'!language' => $vocabulary->language,
)) . '<br />';
$language_mode = array(
I18N_MODE_NONE => t('None'),
I18N_MODE_LOCALIZE => t('Localize'),
I18N_MODE_TRANSLATE => t('Translate'),
I18N_MODE_MULTIPLE => t('Multiple'),
I18N_MODE_LANGUAGE => t('Fixed language'),
);
$message .= t('Internationalization mode of vocabulary: "!language".', array(
'!language' => $language_mode[$vocabulary->i18n_mode],
)) . '<br />';
if ($options['language'] != $vocabulary->language) {
$message .= '<strong>' . t('Warning') . '</strong>: ' . t('Language of imported terms is not the language of the vocabulary. You may check multilingual options to see terms.') . '<br />';
}
}
if ($options['delete_terms']) {
$message .= t('Existing terms of the vocabulary have been deleted.') . '<br />';
}
if (!$options['check_hierarchy']) {
$message .= t('Hierarchy level has been manually set.') . '<br />';
}
$message .= _taxonomy_csv_info_vocabulary_result($vocabulary, $options['vocabulary_target'], $new_hierarchy[$vocabulary_id]) . '<br />';
$messages[] = $message;
}
return implode('<br />', $messages);
}