You are here

class CommerceOptionUIController in Commerce Product Option 7.2

@file Extends the EntityDefaultUIController so we have a better admnin UI.

Hierarchy

Expanded class hierarchy of CommerceOptionUIController

1 string reference to 'CommerceOptionUIController'
commerce_option_entity_info in ./commerce_option.module
Implements hook_entity_info().

File

./commerce_option.inc, line 8
Extends the EntityDefaultUIController so we have a better admnin UI.

View source
class CommerceOptionUIController extends EntityDefaultUIController {

  /**
   * Generates the table headers for the overview table.
   */
  protected function overviewTableHeaders($conditions, $rows, $additional_header = array()) {
    $header = array(
      t('Option id'),
      t('Option set id'),
      t('Order id'),
      t('Commerce product'),
      t('Commerce product id'),
    );

    // Add operations with the right colspan.
    $header[] = array(
      'data' => t('Operations'),
      'colspan' => $this
        ->operationCount(),
    );
    return $header;
  }

  /**
   * Generates the row for the passed entity.
   *
   * @param $additional_cols
   *   Additional columns to be added after the entity label column.
   */
  protected function overviewTableRow($conditions, $id, $entity, $additional_cols = array()) {

    // Option ID.
    $row[] = $entity->option_id;

    // Type
    $row[] = entity_label($this->entityType, $entity);

    // Order info.
    $line_item = commerce_line_item_load($entity->line_item_id);
    $liw = entity_metadata_wrapper('commerce_line_item', $line_item);
    $row[] = l($liw->order_id
      ->value(), 'admin/commerce/orders/' . $liw->order_id
      ->value() . '/view');
    $row[] = $liw->commerce_product->title
      ->value();
    $row[] = $liw->commerce_product->product_id
      ->value();

    // Operations.
    $row[] = l(t('edit'), $this->path . '/manage/' . $id);
    $row[] = l(t('delete'), $this->path . '/manage/' . $id . '/delete', array(
      'query' => drupal_get_destination(),
    ));
    return $row;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CommerceOptionUIController::overviewTableHeaders protected function Generates the table headers for the overview table. Overrides EntityDefaultUIController::overviewTableHeaders
CommerceOptionUIController::overviewTableRow protected function Generates the row for the passed entity. Overrides EntityDefaultUIController::overviewTableRow
EntityDefaultUIController::$entityInfo protected property
EntityDefaultUIController::$entityType protected property
EntityDefaultUIController::$id_count protected property
EntityDefaultUIController::$overviewPagerLimit public property Defines the number of entries to show per page in overview table.
EntityDefaultUIController::applyOperation public function Applies an operation to the given entity.
EntityDefaultUIController::entityFormSubmitBuildEntity public function Entity submit builder invoked via entity_ui_form_submit_build_entity().
EntityDefaultUIController::hook_forms public function Provides definitions for implementing hook_forms().
EntityDefaultUIController::hook_menu public function Provides definitions for implementing hook_menu(). 1
EntityDefaultUIController::operationCount protected function Returns the operation count for calculating colspans.
EntityDefaultUIController::operationForm public function Builds the operation form.
EntityDefaultUIController::operationFormSubmit public function Operation form submit callback. 1
EntityDefaultUIController::operationFormValidate public function Operation form validation callback.
EntityDefaultUIController::overviewForm public function Builds the entity overview form.
EntityDefaultUIController::overviewFormSubmit public function Overview form submit callback.
EntityDefaultUIController::overviewFormValidate public function Overview form validation callback.
EntityDefaultUIController::overviewTable public function Generates the render array for a overview table for arbitrary entities matching the given conditions.
EntityDefaultUIController::__construct public function