function joomla_myblog_map_form in Joomla to Drupal 6
Same name and namespace in other branches
- 7.2 joomla_myblog.module \joomla_myblog_map_form()
- 7 joomla_myblog.module \joomla_myblog_map_form()
1 string reference to 'joomla_myblog_map_form'
File
- ./
joomla_myblog.module, line 20
Code
function joomla_myblog_map_form() {
joomla_database_init();
if (!joomla_database_test()) {
$form['error'] = array(
'#value' => '<p>' . t('The joomla database settings are not currently valid. Please set the correct database settings at <a href="@url">Joomla to Drupal settings</a> page', array(
'@url' => url('admin/settings/joomla'),
)) . '</p>',
);
return $form;
}
$map = joomla_myblog_map();
if (variable_get('joomla_myblog_vocabulary', 0) == 0) {
$form['error'] = array(
'#value' => '<p>' . t('To use this page, an existing vocabulary must be set under <em>Vocabulary for MyBlog tags</em> on the <a href="@url">Joomla to Drupal settings</a> page', array(
'@url' => url('admin/settings/joomla'),
)) . '</p>',
);
return $form;
}
$term_select = taxonomy_form(variable_get('joomla_myblog_vocabulary', 0));
$form['joomla_myblog_map'] = array(
'#type' => 'fieldset',
'#title' => t('Tag mappings'),
'#description' => t('It is possible to map each myblog category to an existing term in the vocabulary select for MyBlog tags.'),
'#tree' => TRUE,
);
$tags = joomla_myblog_tags();
foreach ($tags as $tag) {
$form['joomla_myblog_map'][$tag->id] = $term_select;
$form['joomla_myblog_map'][$tag->id]['#title'] = $tag->name;
if (array_key_exists($tag->id, $map)) {
$form['joomla_myblog_map'][$tag->id]['#default_value'] = $map[$tag->id];
}
}
$form['joomla_myblog_map_submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
}