You are here

function taxonomy_term_depth_entity_base_field_info in Taxonomy Term Depth 8.2

Same name and namespace in other branches
  1. 8 taxonomy_term_depth.module \taxonomy_term_depth_entity_base_field_info()

Implements hook_entity_base_field_info().

File

./taxonomy_term_depth.module, line 297
Main module file.

Code

function taxonomy_term_depth_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) {
  $fields = [];
  if ($entity_type
    ->id() == 'taxonomy_term') {

    // $field_db = \Drupal\Core\Database\Database::getConnection()->schema();
    $fields['depth_level'] = \Drupal\Core\Field\BaseFieldDefinition::create('integer')
      ->setProvider('taxonomy_term_depth')
      ->setLabel(t('Depth'))
      ->setDescription(t('Term depth (1 based)'))
      ->setDefaultValue(NULL);
  }
  return $fields;
}