You are here

function relation_ui_generate_form in Relation 7

Generate relations

1 string reference to 'relation_ui_generate_form'
relation_ui_menu in ./relation_ui.module
Implements hook_menu().

File

./relation_ui.module, line 448
Provide administration interface for relation type bundles.

Code

function relation_ui_generate_form($form, &$form_state) {
  $types = relation_get_types();
  if (empty($types)) {
    $form['explanation']['#markup'] = t("Before you can generate relations, you need to define one or more !link.", array(
      "!link" => l(t('relation types'), 'admin/structure/relation'),
    ));
    return $form;
  }
  foreach ($types as $id => $type) {
    $types[$id] = $type->label;
  }
  $form['relation_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Relation types'),
    '#description' => t('Select relation types to create relations from. If no types are selected, relations will be generated for all types.'),
    '#options' => $types,
  );
  $form['relation_number'] = array(
    '#type' => 'textfield',
    '#title' => t('How many relations would you like to generate of each type?'),
    '#default_value' => 10,
    '#size' => 10,
  );
  $form['relation_kill'] = array(
    '#type' => 'checkbox',
    '#title' => t('Kill all existing relations first.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Generate'),
  );
  return $form;
}