You are here

function path_entity_base_field_info in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/path/path.module \path_entity_base_field_info()

Implements hook_entity_base_field_info().

File

core/modules/path/path.module, line 66
Enables users to rename URLs.

Code

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