You are here

protected function FieldAccess::allowedCommerceOrderItemFields in Commerce Cart API 8

Allowed commerce_order_item fields.

Parameters

string $operation: The operation to be performed.

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition.

\Drupal\Core\Session\AccountInterface $account: The user account to check.

\Drupal\Core\Field\FieldItemListInterface $items: (optional) The entity field object for which to check access, or NULL if access is checked for the field definition, without any specific value available. Defaults to NULL.

Return value

array The allowed fields.

File

src/FieldAccess.php, line 117

Class

FieldAccess

Namespace

Drupal\commerce_cart_api

Code

protected function allowedCommerceOrderItemFields($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
  if ($operation === 'view') {
    return [
      'order_id',
      'order_item_id',
      'uuid',
      'purchased_entity',
      'title',
      // Allow after https://www.drupal.org/project/commerce/issues/2916252.
      // 'adjustments',
      'quantity',
      'order_total',
      'unit_price',
      'total_price',
    ];
  }
  return [];
}