You are here

function data_node_settings_form in Data 6

Form callback for relating a data table to a node.

1 string reference to 'data_node_settings_form'
data_node_menu in data_node/data_node.module
Implementation of hook_menu().

File

data_node/data_node.admin.inc, line 10
Admin UI functionality.

Code

function data_node_settings_form(&$form_state, $table) {
  drupal_set_title(check_plain($table
    ->get('title')));
  $form = array();
  $content_types = array(
    '' => t('None'),
  );
  $content_types += node_get_types('names');
  $meta = $table
    ->get('meta');
  $form['#table'] = $table;
  $form['content_type'] = array(
    '#type' => 'select',
    '#title' => t('Content type'),
    '#options' => $content_types,
    '#default_value' => $meta['data_node']['content_type'],
    '#description' => t('Select the content type this data table can be related to.'),
  );
  $schema = $table
    ->get('table_schema');
  $fields = drupal_map_assoc(array_keys($schema['fields']));
  $form['id'] = array(
    '#type' => 'select',
    '#title' => t('Identifier'),
    '#options' => $fields,
    '#default_value' => $meta['data_node']['id'],
    '#description' => t('Select the identifier of the data table that should be related to a node.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}