You are here

dc_ajax_add_cart_views.module in Commerce Ajax Add to Cart 8

Ajaxifies some cart operations those are related to Views.

File

modules/dc_ajax_add_cart_views/dc_ajax_add_cart_views.module
View source
<?php

/**
 * @file
 * Ajaxifies some cart operations those are related to Views.
 */

/**
 * Implements hook_views_data_alter().
 */
function dc_ajax_add_cart_views_views_data_alter(array &$data) {
  $data['commerce_order_item']['dc_ajax_add_cart_views_remove_button']['field'] = [
    'title' => t('Remove button (Ajax)'),
    'help' => t('Adds a button for removing (ajax) the order item.'),
    'id' => 'dc_ajax_add_cart_views_item_remove_button',
  ];
  $data['commerce_order_item']['dc_ajax_add_cart_views_edit_quantity']['field'] = [
    'title' => t('Quantity text field (Ajax)'),
    'help' => t('Adds a text field for editing the quantity.'),
    'id' => 'dc_ajax_add_cart_views_item_edit_quantity',
  ];
}