You are here

function pm_attribute_list_form in Drupal PM (Project Management) 7

Defines form for attribute list.

1 string reference to 'pm_attribute_list_form'
pm_attribute_list in ./pm.admin.inc
Provides a list of attributes.

File

./pm.admin.inc, line 117
List functions for the Project Management module.

Code

function pm_attribute_list_form($form, &$form_state, $header, $attributes) {
  $form = array();
  $form['attributes']['#theme'] = 'pm_attribute_list';
  $form['attributes']['header'] = array(
    '#value' => $header,
  );
  foreach ($attributes as $attribute) {
    $i = new stdClass();
    $i->type = 'pm_attribute';
    $form['attributes']['attributes'][$attribute->aid]['attribute_domain_' . $attribute->aid] = array(
      '#value' => $attribute->domain,
    );
    $form['attributes']['attributes'][$attribute->aid]['attribute_akey_' . $attribute->aid] = array(
      '#value' => $attribute->akey,
    );
    $form['attributes']['attributes'][$attribute->aid]['attribute_avalue_' . $attribute->aid] = array(
      '#value' => $attribute->avalue,
    );
    $form['attributes']['attributes'][$attribute->aid]['attribute_isactive_' . $attribute->aid] = array(
      '#type' => 'checkbox',
      '#default_value' => $attribute->isactive,
    );
    $form['attributes']['attributes'][$attribute->aid]['attribute_default_' . $attribute->aid] = array(
      '#default_value' => $attribute->isdefault,
    );
    $form['attributes']['attributes'][$attribute->aid]['attribute_weight_' . $attribute->aid] = array(
      '#type' => 'weight',
      '#default_value' => $attribute->weight,
    );
    $form['attributes']['attributes'][$attribute->aid]['attribute_operations_' . $attribute->aid] = array(
      '#value' => pm_icon_edit('pm/attributes/edit/' . $attribute->aid, $i, $_GET) . ' ' . pm_icon_delete('pm/attributes/delete/' . $attribute->aid, $i, $_GET),
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#submit' => array(
      'pm_attribute_list_submit',
    ),
    '#value' => t('Save'),
  );
  return $form;
}