You are here

function uc_product_feature_form in Ubercart 7.3

Same name and namespace in other branches
  1. 5 uc_product/uc_product.module \uc_product_feature_form()
  2. 6.2 uc_product/uc_product.module \uc_product_feature_form()

Returns a form array with some default hidden values and submit button.

Parameters

$form: The form array you wish to add the elements to.

Return value

The form array with elements added for the nid, pfid, submit button, and cancel link.

1 string reference to 'uc_product_feature_form'
uc_product_feature_edit in uc_product/uc_product.admin.inc
Handles adding or editing product features.

File

uc_product/uc_product.module, line 1570
The product module for Ubercart.

Code

function uc_product_feature_form($form, &$form_state, $node, $feature) {
  $form['nid'] = array(
    '#type' => 'hidden',
    '#value' => $node->nid,
  );

  // Forms to add a feature are only given an empty array.
  if (!empty($feature)) {
    $form['pfid'] = array(
      '#type' => 'hidden',
      '#value' => $feature['pfid'],
    );
  }
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save feature'),
  );
  $form['actions']['cancel'] = array(
    '#markup' => l(t('Cancel'), 'node/' . $node->nid . '/edit/features'),
  );
  return $form;
}