You are here

function path_entity_base_field_info_alter in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/path/path.module \path_entity_base_field_info_alter()
  2. 10 core/modules/path/path.module \path_entity_base_field_info_alter()

Implements hook_entity_base_field_info_alter().

File

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

Code

function path_entity_base_field_info_alter(&$fields, EntityTypeInterface $entity_type) {

  /** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
  if ($entity_type
    ->id() === 'path_alias') {
    $fields['langcode']
      ->setDisplayOptions('form', [
      'type' => 'language_select',
      'weight' => 0,
      'settings' => [
        'include_locked' => FALSE,
      ],
    ]);
    $fields['path']
      ->setDisplayOptions('form', [
      'type' => 'string_textfield',
      'weight' => 5,
      'settings' => [
        'size' => 45,
      ],
    ]);
    $fields['alias']
      ->setDisplayOptions('form', [
      'type' => 'string_textfield',
      'weight' => 10,
      'settings' => [
        'size' => 45,
      ],
    ]);
  }
}