Untitled

mail@pastecode.io avatarunknown
plain_text
2 months ago
583 B
1
Indexable
Never
/**
 * Implements hook_entity_base_field_info().
 */
function YOUR_MODULE_NAME_entity_base_field_info(EntityTypeInterface $entity_type) {
  $fields = array();

  if ($entity_type->id() == 'YOUR_ENTITY_TYPE') { // Replace with your entity type ID
    $fields['custom_concatenated_name_field'] = BaseFieldDefinition::create('string')
      ->setLabel(t('Custom Concatenated Name'))
      ->setDescription(t('The concatenated name field.'))
      ->setSortable(TRUE); // Enables sorting on this field

    // Additional settings for your field can be added here
  }

  return $fields;
}