Commit ec32a7b9 authored by Lendude's avatar Lendude Committed by bojanz
Browse files

Issue #2882374 by xSDx, Lendude, drugan, bojanz: Views filters are broken for...

Issue #2882374 by xSDx, Lendude, drugan, bojanz: Views filters are broken for price fields ("number" column)
parent def442db
......@@ -23,7 +23,7 @@ use Drupal\Core\Field\BaseFieldDefinition;
* "list_builder" = "Drupal\commerce_log\LogListBuilder",
* "storage" = "Drupal\commerce_log\LogStorage",
* "view_builder" = "Drupal\commerce_log\LogViewBuilder",
* "views_data" = "Drupal\views\EntityViewsData",
* "views_data" = "Drupal\commerce\CommerceEntityViewsData",
* },
* base_table = "commerce_log",
* entity_keys = {
......
......@@ -32,7 +32,7 @@ use Drupal\profile\Entity\ProfileInterface;
* "access" = "Drupal\commerce_order\OrderAccessControlHandler",
* "permission_provider" = "Drupal\commerce_order\OrderPermissionProvider",
* "list_builder" = "Drupal\commerce_order\OrderListBuilder",
* "views_data" = "Drupal\views\EntityViewsData",
* "views_data" = "Drupal\commerce\CommerceEntityViewsData",
* "form" = {
* "default" = "Drupal\commerce_order\Form\OrderForm",
* "add" = "Drupal\commerce_order\Form\OrderForm",
......
......@@ -2,12 +2,12 @@
namespace Drupal\commerce_order;
use Drupal\views\EntityViewsData;
use Drupal\commerce\CommerceEntityViewsData;
/**
* Provides views data for order items.
*/
class OrderItemViewsData extends EntityViewsData {
class OrderItemViewsData extends CommerceEntityViewsData {
/**
* {@inheritdoc}
......
......@@ -32,7 +32,7 @@ use Drupal\Core\Field\BaseFieldDefinition;
* "operation" = "Drupal\commerce_payment\Form\PaymentOperationForm",
* "delete" = "Drupal\Core\Entity\ContentEntityDeleteForm",
* },
* "views_data" = "Drupal\views\EntityViewsData",
* "views_data" = "Drupal\commerce\CommerceEntityViewsData",
* "route_provider" = {
* "default" = "Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider",
* },
......
......@@ -32,7 +32,7 @@ use Drupal\user\UserInterface;
* "permission_provider" = "Drupal\entity\EntityPermissionProvider",
* "view_builder" = "Drupal\commerce_product\ProductViewBuilder",
* "list_builder" = "Drupal\commerce_product\ProductListBuilder",
* "views_data" = "Drupal\views\EntityViewsData",
* "views_data" = "Drupal\commerce\CommerceEntityViewsData",
* "form" = {
* "default" = "Drupal\commerce_product\Form\ProductForm",
* "add" = "Drupal\commerce_product\Form\ProductForm",
......
......@@ -25,7 +25,7 @@ use Drupal\Core\Field\BaseFieldDefinition;
* "storage" = "Drupal\commerce_product\ProductAttributeValueStorage",
* "access" = "Drupal\commerce\EmbeddedEntityAccessControlHandler",
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
* "views_data" = "Drupal\views\EntityViewsData",
* "views_data" = "Drupal\commerce\CommerceEntityViewsData",
* "translation" = "Drupal\content_translation\ContentTranslationHandler"
* },
* admin_permission = "administer commerce_product_attribute",
......
......@@ -32,7 +32,7 @@ use Drupal\user\UserInterface;
* "storage" = "Drupal\commerce_product\ProductVariationStorage",
* "access" = "Drupal\commerce\EmbeddedEntityAccessControlHandler",
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
* "views_data" = "Drupal\views\EntityViewsData",
* "views_data" = "Drupal\commerce\CommerceEntityViewsData",
* "form" = {
* "default" = "Drupal\Core\Entity\ContentEntityForm",
* },
......
......@@ -25,7 +25,7 @@ use Drupal\Core\Entity\EntityTypeInterface;
* "list_builder" = "Drupal\commerce_promotion\CouponListBuilder",
* "storage" = "Drupal\commerce_promotion\CouponStorage",
* "access" = "Drupal\commerce_promotion\CouponAccessControlHandler",
* "views_data" = "Drupal\views\EntityViewsData",
* "views_data" = "Drupal\commerce\CommerceEntityViewsData",
* "form" = {
* "add" = "Drupal\commerce_promotion\Form\CouponForm",
* "edit" = "Drupal\commerce_promotion\Form\CouponForm",
......
......@@ -32,7 +32,7 @@ use Drupal\Core\Field\BaseFieldDefinition;
* "permission_provider" = "Drupal\entity\EntityPermissionProvider",
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
* "list_builder" = "Drupal\commerce_promotion\PromotionListBuilder",
* "views_data" = "Drupal\views\EntityViewsData",
* "views_data" = "Drupal\commerce\CommerceEntityViewsData",
* "form" = {
* "default" = "Drupal\commerce_promotion\Form\PromotionForm",
* "add" = "Drupal\commerce_promotion\Form\PromotionForm",
......
......@@ -31,7 +31,7 @@ use Drupal\Core\Field\BaseFieldDefinition;
* "permission_provider" = "Drupal\entity\EntityPermissionProvider",
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
* "list_builder" = "Drupal\commerce_store\StoreListBuilder",
* "views_data" = "Drupal\views\EntityViewsData",
* "views_data" = "Drupal\commerce\CommerceEntityViewsData",
* "form" = {
* "default" = "Drupal\commerce_store\Form\StoreForm",
* "add" = "Drupal\commerce_store\Form\StoreForm",
......
<?php
namespace Drupal\commerce;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\views\EntityViewsData;
/**
* Provides improvements to core's generic views integration for entities.
*/
class CommerceEntityViewsData extends EntityViewsData {
/**
* Corrects the views data for commerce_price base fields.
*
* @param string $table
* The table name.
* @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
* The field definition.
* @param array $views_field
* The views field data.
* @param string $field_column_name
* The field column being processed.
*/
protected function processViewsDataForCommercePrice($table, FieldDefinitionInterface $field_definition, array &$views_field, $field_column_name) {
if ($field_column_name == 'number') {
$views_field['filter']['id'] = 'numeric';
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment