function path_entity_base_field_info

path_entity_base_field_info(EntityTypeInterface $entity_type)

Implements hook_entity_base_field_info().

File

core/modules/path/path.module, line 65
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;
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!path!path.module/function/path_entity_base_field_info/8.1.x