function tripal_feature_edit_ALL_properties_form

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

Implements Hook_form() Handles adding of Properties for features

Related topics

2 string references to 'tripal_feature_edit_ALL_properties_form'
tripal_feature_edit_ALL_properties_page in tripal_feature/includes/tripal_feature-properties.inc
tripal_feature_theme in tripal_feature/tripal_feature.module
We need to let drupal know about our theme functions and their arguments. We create theme functions to allow users of the module to customize the look and feel of the output generated in this module

File

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

Code

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

  $form['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'
  );

  if (sizeof($properties)) {

    // build the select box options for the property name
    $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;
    }

    // iterate through all of the properties and create a set of form elements
    foreach ($properties as $i => $property) {
      $form["num-$i"] = array(
        '#type' => 'fieldset',
        '#value' => "Property $i"
      );
      $form["num-$i"]["id-$i"] = array(
        '#type' => 'hidden',
        '#value' => $property->featureprop_id
      );
      $default = array_search($property->type, $prop_type_options);
      $form["num-$i"]["type-$i"] = array(
        '#type' => 'select',
        '#options' => $prop_type_options,
        '#default_value' => $property->type_id->name
      );
      $form["num-$i"]["value-$i"] = array(
        '#type' => 'textfield',
        '#default_value' => $property->value
      );
      $form["num-$i"]["delete-$i"] = array(
        '#type' => 'submit',
        '#value' => t("Delete"),
        '#name' => "delete-$i",
      );
    } //end of foreach property

    $form['num_properties'] = array(
      '#type' => 'hidden',
      '#value' => $i
    );

    $form["submit-edits"] = array(
      '#type' => 'submit',
      '#value' => t('Update All Properties')
    );
  }

  return $form;
}