You are here

function commerce_option_attribute_field in Commerce Product Option 7

Implements hook_attribute_field()

File

./commerce_option.module, line 442

Code

function commerce_option_attribute_field(&$element, &$line_item) {
  $element['options'] = array();
  $options = commerce_option_load_by_line_item($line_item->line_item_id);
  foreach ($options as $option) {
    field_attach_prepare_view('commerce_option', array(
      $option->option_id => $option,
    ), 'attribute_view');
    $option_view = field_attach_view('commerce_option', $option, 'attribute_view');
    $element['options'][] = array(
      '#markup' => drupal_render($option_view),
    );
  }

  /*if (count($sub_items) > 0) {

      $element['#attached']['css'][] = drupal_get_path('module', 'commerce_product_bundle') . '/theme/commerce_product_bundle_cart.css';

      foreach ($sub_items as $item) {


        $item_wrapper = entity_metadata_wrapper('commerce_line_item', $item);


        $element['bundles'][] = array(
          '#markup' => theme('commerce_product_bundle_attribute', array('sub_line_item' => $item, 'product_attribute_view' => drupal_render($product_attribute_view))),
        );
      }
    }*/
}