You are here

function commerce_cart_entity_base_field_info in Commerce Core 8.2

Implements hook_entity_base_field_info().

File

modules/cart/commerce_cart.module, line 72
Implements the shopping cart system and add to cart features.

Code

function commerce_cart_entity_base_field_info(EntityTypeInterface $entity_type) {
  if ($entity_type
    ->id() === 'commerce_order') {
    $fields['cart'] = BaseFieldDefinition::create('boolean')
      ->setLabel(t('Cart'))
      ->setSettings([
      'on_label' => t('Yes'),
      'off_label' => t('No'),
    ])
      ->setDisplayOptions('form', [
      'type' => 'boolean_checkbox',
      'settings' => [
        'display_label' => TRUE,
      ],
      'weight' => 20,
    ])
      ->setDisplayConfigurable('form', TRUE)
      ->setDefaultValue(FALSE);
    return $fields;
  }
}