You are here

public function Second::buildFieldDefinitions in Entity API 8

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 BundlePluginInterface::buildFieldDefinitions

File

tests/modules/entity_module_bundle_plugin_examples_test/src/Plugin/BundlePluginTest/Second.php, line 22

Class

Second
Provides the second bundle plugin.

Namespace

Drupal\entity_module_bundle_plugin_examples_test\Plugin\BundlePluginTest

Code

public function buildFieldDefinitions() {
  $fields = [];
  $fields['second_mail'] = BundleFieldDefinition::create('email')
    ->setLabel(t('Email'))
    ->setRequired(TRUE);
  return $fields;
}