You are here

function apigee_edge_entity_base_field_info in Apigee Edge 8

Implements hook_entity_base_field_info().

File

./apigee_edge.module, line 275
Copyright 2018 Google Inc.

Code

function apigee_edge_entity_base_field_info(EntityTypeInterface $entity_type) {
  $fields = [];
  if ($entity_type
    ->id() === 'user') {
    $fields['first_name'] = BaseFieldDefinition::create('string')
      ->setLabel(t('First name'))
      ->setDescription(t('Your first name.'))
      ->setSetting('max_length', 64)
      ->setRequired(TRUE)
      ->setInitialValue('Firstname')
      ->setDisplayOptions('form', [
      'type' => 'string_textfield',
      'weight' => '-11',
      'settings' => [
        'display_label' => TRUE,
      ],
    ])
      ->setDisplayConfigurable('form', TRUE);
    $fields['last_name'] = BaseFieldDefinition::create('string')
      ->setLabel(t('Last name'))
      ->setDescription(t('Your last name.'))
      ->setSetting('max_length', 64)
      ->setRequired(TRUE)
      ->setInitialValue('Lastname')
      ->setDisplayOptions('form', [
      'type' => 'string_textfield',
      'weight' => '-11',
      'settings' => [
        'display_label' => TRUE,
      ],
    ])
      ->setDisplayConfigurable('form', TRUE);
    $fields['apigee_edge_developer_id'] = BaseFieldDefinition::create('string')
      ->setName('apigee_edge_developer_id')
      ->setLabel(t('Apigee Edge Developer ID'))
      ->setComputed(TRUE)
      ->setClass(ApigeeEdgeDeveloperIdFieldItem::class);
  }
  return $fields;
}