You are here

url_alias_permissions_test.module in URL Alias Permissions 8

Support module for URL Alias Permissions tests.

File

tests/modules/url_alias_permissions_test.module
View source
<?php

/**
 * @file
 * Support module for URL Alias Permissions tests.
 */
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;

/**
 * Implements hook_entity_base_field_info().
 *
 * Add a path field to entity_test.
 */
function url_alias_permissions_test_entity_base_field_info(EntityTypeInterface $entity_type) {
  if ($entity_type
    ->id() === 'entity_test') {
    $fields['url_alias'] = BaseFieldDefinition::create('path')
      ->setLabel(t('URL alias'))
      ->setTranslatable(TRUE)
      ->setDisplayOptions('form', [
      'type' => 'path',
      'weight' => 30,
    ])
      ->setDisplayConfigurable('form', TRUE)
      ->setComputed(TRUE);
    return $fields;
  }
}