function path_entity_base_field_info

Same name in other branches
  1. 9 core/modules/path/path.module \path_entity_base_field_info()
  2. 8.9.x core/modules/path/path.module \path_entity_base_field_info()
  3. 11.x core/modules/path/path.module \path_entity_base_field_info()

Implements hook_entity_base_field_info().

File

core/modules/path/path.module, line 100

Code

function path_entity_base_field_info(EntityTypeInterface $entity_type) {
    if (in_array($entity_type->id(), [
        'taxonomy_term',
        'node',
        'media',
    ], TRUE)) {
        $fields['path'] = BaseFieldDefinition::create('path')->setLabel(t('URL alias'))
            ->setTranslatable(TRUE)
            ->setDisplayOptions('form', [
            'type' => 'path',
            'weight' => 30,
        ])
            ->setDisplayConfigurable('form', TRUE)
            ->setComputed(TRUE);
        return $fields;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.