You are here

public function File::buildFieldDefinitions in Commerce File 8.2

Builds the field definitions for entities of this bundle.

Important: Field names must be unique across all bundles. It is recommended to prefix them with the bundle name (plugin ID).

Return value

\Drupal\entity\BundleFieldDefinition[] An array of bundle field definitions, keyed by field name.

Overrides LicenseTypeBase::buildFieldDefinitions

File

src/Plugin/Commerce/LicenseType/File.php, line 133

Class

File
The file license type.

Namespace

Drupal\commerce_file\Plugin\Commerce\LicenseType

Code

public function buildFieldDefinitions() {
  $fields = parent::buildFieldDefinitions();
  $fields['file_download_limit'] = BundleFieldDefinition::create('integer')
    ->setLabel($this
    ->t('Download limit'))
    ->setRequired(FALSE)
    ->setSetting('unsigned', TRUE)
    ->setDisplayOptions('form', [
    'type' => 'commerce_file_download_limit',
  ]);
  return $fields;
}