function tripal_feature_add_ONE_property_form

1.x tripal_feature-properties.inc tripal_feature_add_ONE_property_form($form_state, $node, $expand)

Related topics

1 string reference to 'tripal_feature_add_ONE_property_form'

File

tripal_feature/includes/tripal_feature-properties.inc, line 36
@todo Add file header description

Code

function tripal_feature_add_ONE_property_form($form_state, $node, $expand) {
  $form = array();
  $feature_id = $node->feature->feature_id;

  $form['add_properties'] = array(
    '#type' => 'fieldset',
    '#title' => t('Add Property'),
    '#collapsible' => TRUE,
    '#collapsed' => ($expand) ? FALSE : TRUE,
  );

  $form['prop_nid'] = array(
    '#type' => 'hidden',
    '#value' => $node->nid
  );

  $form['add_properties']['feature_id'] = array(
    '#type' => 'value',
    '#value' => $feature_id,
    '#required' => TRUE
  );

  // right now this defaults to the 'feature_property' CV
  // but in the future it should be more flexible
  $form['cv_name'] = array(
    '#type' => 'hidden',
    '#value' => 'feature_property'
  );

  // get the list of property types
  $prop_type_options = array();
  $columns = array('cvterm_id', 'name');
  $values = array(
    'cv_id' => array(
      'name' => $form['cv_name']['#value'],
    )
  );
  $results = tripal_core_chado_select('cvterm', $columns, $values);
  foreach ($results as $r) {
    $prop_type_options[$r->name] = $r->name;
  }

  $form['add_properties']['property'] = array(
    '#type' => 'select',
    '#title' => t('Type of Property'),
    '#options' => $prop_type_options,
  );

  $form['add_properties']['prop_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Value'),
  );

  $form['add_properties']['submit-add'] = array(
    '#type' => 'submit',
    '#value' => t('Add Property')
  );

  return $form;
}