function evoc_import_form in RDF Extensions 7.2
1 string reference to 'evoc_import_form'
- evoc_import in evoc/
evoc.pages.inc - Present a node submission form or a set of links to such forms.
File
- evoc/
evoc.pages.inc, line 16 - Page callbacks for importing a vocabulary.
Code
function evoc_import_form($form_state) {
// Retrieves all the imported namespaces from the database.
$query = db_select('rdfx_vocabulary_graphs', 'g');
$query
->fields('n', array(
'prefix',
'uri',
));
$query
->join('rdfx_namespaces', 'n', 'g.main_ns = n.nsid');
$query
->orderBy('n.prefix');
$namespaces = $query
->execute()
->fetchAll();
if (count($namespaces) == 0) {
$namespace_msg = '<p>No RDF vocabularies have been imported. It is recommended that you ' . l('import the core RDF vocabularies', 'evoc/import_core') . '.</p>';
}
else {
$table_variables = array();
foreach ($namespaces as $namespace) {
$table_variables['rows'][] = array(
$namespace->prefix,
$namespace->uri,
);
}
$namespace_msg = theme('table', $table_variables);
}
$form['help'] = array(
'#type' => 'item',
'#markup' => '<p>This form allows you to import external RDF vocabularies into your site.
These can later be used by other modules such as <a href="http://drupal.org/project/rdf">RDF UI</a> or <a href="http://drupal.org/project/neologism">Neologism</a>.</p>',
);
$form['namespace_box'] = array(
'#type' => 'fieldset',
'#title' => 'Imported vocabularies',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['namespace_box']['namespaces'] = array(
'#type' => 'item',
'#markup' => $namespace_msg,
);
$form['prefix'] = array(
'#type' => 'textfield',
'#title' => t('Prefix'),
'#required' => TRUE,
'#default_value' => isset($form_state['values']['prefix']) ? $form_state['values']['prefix'] : NULL,
'#description' => "Choose a prefix for this vocabulary. Example: dc, foaf, sioc etc. This prefix will later be used in the system to refer to this vocabulary.",
);
$form['ns_uri'] = array(
'#type' => 'textfield',
'#title' => t('Vocabulary URI'),
'#required' => TRUE,
'#default_value' => isset($form_state['values']['ns_uri']) ? $form_state['values']['ns_uri'] : NULL,
'#description' => "Enter the URI of the vocabulary to import. Make sure it finishes by either / or #.",
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Submit',
);
return $form;
}