You are here

function uc_product_features in Ubercart 7.3

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

Displays the product features tab on a product node edit form.

5 string references to 'uc_product_features'
uc_file_admin_files_form_show_files in uc_file/uc_file.admin.inc
Displays all files that may be purchased and downloaded for administration.
uc_file_schema in uc_file/uc_file.install
Implements hook_schema().
uc_product_feature_save in uc_product/uc_product.module
Saves a product feature to a product node.
uc_product_menu in uc_product/uc_product.module
Implements hook_menu().
uc_roles_schema in uc_roles/uc_roles.install
Implements hook_schema().

File

uc_product/uc_product.admin.inc, line 120
Product administration menu items.

Code

function uc_product_features($node, $fid = NULL, $pfid = NULL) {
  drupal_set_title($node->title);
  $header = array(
    t('Type'),
    t('Description'),
    t('Operations'),
  );
  $rows = array();
  $features = uc_product_feature_load_multiple($node->nid);
  foreach ($features as $feature) {
    $operations = array(
      'edit' => array(
        'title' => t('edit'),
        'href' => 'node/' . $node->nid . '/edit/features/' . $feature->fid . '/' . $feature->pfid,
      ),
      'delete' => array(
        'title' => t('delete'),
        'href' => 'node/' . $node->nid . '/edit/features/' . $feature->fid . '/' . $feature->pfid . '/delete',
      ),
    );
    $rows[] = array(
      array(
        'data' => uc_product_feature_data($feature->fid, 'title'),
      ),
      array(
        'data' => $feature->description,
      ),
      theme('links', array(
        'links' => $operations,
        'attributes' => array(
          'class' => array(
            'links',
            'inline',
          ),
        ),
      )),
    );
  }
  $build['features'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#attributes' => array(
      'class' => array(
        'uc-product-features',
      ),
    ),
    '#empty' => t('No features found for this product.'),
  );
  $build['add_form'] = drupal_get_form('uc_product_feature_add_form', $node);
  return $build;
}