You are here

protected function FieldAccess::allowedCommerceOrderFields in Commerce Cart API 8

Allowed commerce_order 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 82

Class

FieldAccess

Namespace

Drupal\commerce_cart_api

Code

protected function allowedCommerceOrderFields($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
  if ($operation === 'view') {
    return [
      'order_id',
      'uuid',
      'order_number',
      'store_id',
      // Allow after https://www.drupal.org/project/commerce/issues/2916252.
      // 'adjustments',
      'coupons',
      'order_total',
      'total_price',
      'order_items',
    ];
  }
  return [];
}