Commit 5842d6ff authored by bojanz's avatar bojanz

Merge the line_item module into the order module.

parent fe04a346
name: Commerce Line Item
type: module
description: 'Defines the Line Item entity and associated features.'
package: Commerce
core: 8.x
dependencies:
- commerce
- commerce_price
- commerce_product
config_devel:
- commerce_line_item.commerce_line_item_type.product_variation
- core.entity_form_display.commerce_line_item.product_variation.default
- core.entity_view_display.commerce_line_item.product_variation.default
entity.commerce_line_item_type.add_form:
route_name: entity.commerce_line_item_type.add_form
title: 'Add a new line item type'
appears_on:
- entity.commerce_line_item_type.collection
entity.commerce_line_item_type.collection:
title: Line item types
route_name: entity.commerce_line_item_type.collection
parent: commerce.configuration
description: 'Manage your line item types.'
entity.commerce_line_item_type.edit_form:
route_name: entity.commerce_line_item_type.edit_form
base_route: entity.commerce_line_item_type.edit_form
title: Edit
<?php
/**
* @file
* Defines the core Commerce line item entity type and API functions to manage
* line items and interact with them.
*/
'administer line items':
title: 'Administer line items'
description: 'Allows users to administer line items.'
'restrict access': TRUE
'administer line item types':
title: 'Administer line item types'
description: 'Allows users to administer line item types.'
'restrict access': TRUE
entity.commerce_line_item_type.collection:
path: '/admin/commerce/config/line-item-types'
defaults:
_entity_list: 'commerce_line_item_type'
_title: 'Line item types'
requirements:
_permission: 'administer line item types'
entity.commerce_line_item_type.edit_form:
path: '/admin/commerce/config/line-item-types/{commerce_line_item_type}/edit'
defaults:
_entity_form: commerce_line_item_type.edit
_title: 'Edit a line item type'
requirements:
_entity_access: 'commerce_line_item_type.edit'
entity.commerce_line_item_type.add_form:
path: '/admin/commerce/config/line-item-types/add'
defaults:
_entity_form: 'commerce_line_item_type.add'
_title: 'Add a new line item type'
requirements:
_entity_create_access: 'commerce_line_item_type'
entity.commerce_line_item_type.delete_form:
path: '/admin/commerce/config/line-item-types/{commerce_line_item_type}/delete'
defaults:
_entity_form: 'commerce_line_item_type.delete'
_title: 'Delete a line item type'
requirements:
_entity_access: 'commerce_line_item_type.delete'
commerce_line_item.commerce_line_item_type.*:
type: config_entity
label: 'Line item type'
mapping:
label:
type: label
label: 'Label'
id:
type: string
label: 'Machine-readable name'
sourceEntityType:
type: string
label: 'Source entity type'
orderType:
type: string
label: 'Order type'
......@@ -5,7 +5,6 @@ package: Commerce
core: 8.x
dependencies:
- commerce
- commerce_line_item
- commerce_price
- commerce_store
- entity_reference
......@@ -14,7 +13,10 @@ dependencies:
config_devel:
- views.view.commerce_orders
- commerce_order.commerce_order_type.default
- commerce_order.commerce_line_item_type.product_variation
- field.field.commerce_order.default.line_items
- core.entity_form_display.commerce_order.default.default
- field.storage.commerce_order.line_items
- core.entity_form_display.commerce_order.default.default
- core.entity_view_display.commerce_order.default.default
- core.entity_form_display.commerce_line_item.product_variation.default
- core.entity_view_display.commerce_line_item.product_variation.default
......@@ -9,3 +9,9 @@ entity.commerce_order_type.add_form:
title: 'Add a new order type'
appears_on:
- entity.commerce_order_type.collection
entity.commerce_line_item_type.add_form:
route_name: entity.commerce_line_item_type.add_form
title: 'Add a new line item type'
appears_on:
- entity.commerce_line_item_type.collection
......@@ -9,3 +9,9 @@ entity.commerce_order_type.collection:
route_name: entity.commerce_order_type.collection
parent: commerce.configuration
description: 'Manage your order types.'
entity.commerce_line_item_type.collection:
title: Line item types
route_name: entity.commerce_line_item_type.collection
parent: commerce.configuration
description: 'Manage your line item types.'
......@@ -7,3 +7,8 @@ entity.commerce_order.admin_form:
route_name: 'entity.commerce_order.admin_form'
base_route: 'entity.commerce_order.admin_form'
title: 'Edit'
entity.commerce_line_item_type.edit_form:
route_name: entity.commerce_line_item_type.edit_form
base_route: entity.commerce_line_item_type.edit_form
title: Edit
......@@ -7,3 +7,8 @@
title: 'Administer order types'
description: 'Allows users to create, update, and delete order types.'
'restrict access': TRUE
'administer line item types':
title: 'Administer line item types'
description: 'Allows users to administer line item types.'
'restrict access': TRUE
......@@ -91,3 +91,35 @@ entity.commerce_order_type.delete_form:
_title: 'Delete an order type'
requirements:
_entity_access: 'commerce_order_type.delete'
entity.commerce_line_item_type.collection:
path: '/admin/commerce/config/line-item-types'
defaults:
_entity_list: 'commerce_line_item_type'
_title: 'Line item types'
requirements:
_permission: 'administer line item types'
entity.commerce_line_item_type.edit_form:
path: '/admin/commerce/config/line-item-types/{commerce_line_item_type}/edit'
defaults:
_entity_form: commerce_line_item_type.edit
_title: 'Edit a line item type'
requirements:
_entity_access: 'commerce_line_item_type.edit'
entity.commerce_line_item_type.add_form:
path: '/admin/commerce/config/line-item-types/add'
defaults:
_entity_form: 'commerce_line_item_type.add'
_title: 'Add a new line item type'
requirements:
_entity_create_access: 'commerce_line_item_type'
entity.commerce_line_item_type.delete_form:
path: '/admin/commerce/config/line-item-types/{commerce_line_item_type}/delete'
defaults:
_entity_form: 'commerce_line_item_type.delete'
_title: 'Delete a line item type'
requirements:
_entity_access: 'commerce_line_item_type.delete'
......@@ -2,7 +2,7 @@ langcode: en
status: true
dependencies:
config:
- commerce_line_item.commerce_line_item_type.product_variation
- commerce_order.commerce_line_item_type.product_variation
module:
- commerce_price
id: commerce_line_item.product_variation.default
......
......@@ -2,7 +2,7 @@ langcode: en
status: true
dependencies:
config:
- commerce_line_item.commerce_line_item_type.product_variation
- commerce_order.commerce_line_item_type.product_variation
module:
- commerce_price
- user
......
......@@ -11,3 +11,20 @@ commerce_order.commerce_order_type.*:
description:
type: text
label: 'Description'
commerce_order.commerce_line_item_type.*:
type: config_entity
label: 'Line item type'
mapping:
label:
type: label
label: 'Label'
id:
type: string
label: 'Machine-readable name'
sourceEntityType:
type: string
label: 'Source entity type'
orderType:
type: string
label: 'Order type'
......@@ -2,12 +2,12 @@
/**
* @file
* Contains \Drupal\commerce_line_item\Entity\LineItem.
* Contains \Drupal\commerce_order\Entity\LineItem.
*/
namespace Drupal\commerce_line_item\Entity;
namespace Drupal\commerce_order\Entity;
use Drupal\commerce_line_item\LineItemInterface;
use Drupal\commerce_order\LineItemInterface;
use Drupal\Core\Entity\EntityChangedTrait;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\BaseFieldDefinition;
......@@ -24,11 +24,11 @@ use Drupal\user\UserInterface;
* handlers = {
* "views_data" = "Drupal\views\EntityViewsData",
* "form" = {
* "default" = "Drupal\commerce_line_item\Form\LineItemForm",
* "default" = "Drupal\commerce_order\Form\LineItemForm",
* }
* },
* base_table = "commerce_line_item",
* admin_permission = "administer line items",
* admin_permission = "administer orders",
* fieldable = TRUE,
* entity_keys = {
* "id" = "line_item_id",
......@@ -187,7 +187,7 @@ class LineItem extends ContentEntityBase implements LineItemInterface {
->setRevisionable(TRUE)
->setSetting('target_type', 'user')
->setSetting('handler', 'default')
->setDefaultValueCallback('Drupal\commerce_line_item\Entity\CommerceLineItem::getCurrentUserId')
->setDefaultValueCallback('Drupal\commerce_order\Entity\CommerceLineItem::getCurrentUserId')
->setTranslatable(TRUE)
->setDisplayOptions('view', [
'label' => 'hidden',
......
......@@ -2,12 +2,12 @@
/**
* @file
* Contains \Drupal\commerce_line_item\Entity\LineItemType.
* Contains \Drupal\commerce_order\Entity\LineItemType.
*/
namespace Drupal\commerce_line_item\Entity;
namespace Drupal\commerce_order\Entity;
use Drupal\commerce_line_item\LineItemTypeInterface;
use Drupal\commerce_order\LineItemTypeInterface;
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
/**
......@@ -18,11 +18,11 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
* label = @Translation("Line item type"),
* handlers = {
* "form" = {
* "add" = "Drupal\commerce_line_item\Form\LineItemTypeForm",
* "edit" = "Drupal\commerce_line_item\Form\LineItemTypeForm",
* "delete" = "Drupal\commerce_line_item\Form\LineItemTypeDeleteForm"
* "add" = "Drupal\commerce_order\Form\LineItemTypeForm",
* "edit" = "Drupal\commerce_order\Form\LineItemTypeForm",
* "delete" = "Drupal\commerce_order\Form\LineItemTypeDeleteForm"
* },
* "list_builder" = "Drupal\commerce_line_item\LineItemTypeListBuilder",
* "list_builder" = "Drupal\commerce_order\LineItemTypeListBuilder",
* },
* admin_permission = "administer line item types",
* config_prefix = "commerce_line_item_type",
......
<?php
/**
* @file
* Definition of Drupal\commerce_line_item\Form\LineItemForm.
* Contains \Drupal\commerce_order\Form\LineItemForm.
*/
namespace Drupal\commerce_line_item\Form;
namespace Drupal\commerce_order\Form;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Form\FormStateInterface;
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\commerce_line_item\Form\LineItemTypeDeleteForm.
* Contains \Drupal\commerce_order\Form\LineItemTypeDeleteForm.
*/
namespace Drupal\commerce_line_item\Form;
namespace Drupal\commerce_order\Form;
use Drupal\Core\Entity\EntityDeleteForm;
use Drupal\Core\Entity\Query\QueryFactory;
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains Drupal\commerce_line_item\Form\LineItemTypeForm.
* Contains \Drupal\commerce_order\Form\LineItemTypeForm.
*/
namespace Drupal\commerce_line_item\Form;
namespace Drupal\commerce_order\Form;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
......
<?php
/**
* @file
* Definition of Drupal\commerce_order\Form\OrderForm.
* Contains \Drupal\commerce_order\Form\OrderForm.
*/
namespace Drupal\commerce_order\Form;
use Drupal\Core\Entity\ContentEntityForm;
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains Drupal\commerce_order\Form\OrderTypeForm.
* Contains \Drupal\commerce_order\Form\OrderTypeForm.
*/
namespace Drupal\commerce_order\Form;
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\commerce_line_item\LineItemInterface.
* Contains \Drupal\commerce_order\LineItemInterface.
*/
namespace Drupal\commerce_line_item;
namespace Drupal\commerce_order;
use Drupal\Core\Entity\EntityChangedInterface;
use Drupal\Core\Entity\EntityInterface;
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\commerce_line_item\LineItemTypeInterface.
* Contains \Drupal\commerce_order\LineItemTypeInterface.
*/
namespace Drupal\commerce_line_item;
namespace Drupal\commerce_order;
use Drupal\Core\Config\Entity\ConfigEntityInterface;
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\commerce_line_item\Entity\LineItemTypeListBuilder.
* Contains \Drupal\commerce_order\Entity\LineItemTypeListBuilder.
*/
namespace Drupal\commerce_line_item;
namespace Drupal\commerce_order;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
......
......@@ -39,9 +39,9 @@ abstract class CommerceOrderTestBase extends WebTestBase {
*/
public static $modules = [
'commerce',
'commerce_product',
'commerce_order',
'commerce_price',
'commerce_line_item',
'inline_entity_form'
];
......
......@@ -8,7 +8,7 @@
namespace Drupal\commerce_order\Tests;
use Drupal\commerce_order\Entity\Order;
use Drupal\commerce_line_item\Entity\LineItem;
use Drupal\commerce_order\Entity\LineItem;
/**
* Tests the commerce_order entity forms.
......
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