You are here

function theme_civicrm_entity_price_set_field_price_field_drag_components in CiviCRM Entity 7.2

Theme function for price field form components

Parameters

$vars:

Return value

string|void

1 theme call to theme_civicrm_entity_price_set_field_price_field_drag_components()
civicrm_entity_price_set_field_field_widget_form_alter in modules/civicrm_entity_price_set_field/civicrm_entity_price_set_field.module
Implements hook_field_widget_form_alter().

File

modules/civicrm_entity_price_set_field/civicrm_entity_price_set_field.module, line 857

Code

function theme_civicrm_entity_price_set_field_price_field_drag_components($vars) {
  $element = $vars['element'];
  drupal_add_tabledrag('price_field_value_table', 'order', 'sibling', 'item-row-weight');
  $header = array(
    '' => '',
    'weight' => t('Weight'),
    'label' => t('Label'),
    'amount' => t('Amount'),
    'is_default' => t('Default'),
    'remove_row' => t('Delete'),
  );
  $rows = array();
  foreach (element_children($element) as $key) {
    $row = array();
    $row['data'] = array();
    foreach ($header as $fieldname => $title) {
      $row['data'][] = drupal_render($element[$key][$fieldname]);
      $row['class'] = array(
        'draggable',
      );
    }
    $rows[] = $row;
  }
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'price_field_value_table',
    ),
  ));
}