function PathHooks::entityBaseFieldInfoAlter

Implements hook_entity_base_field_info_alter().

File

core/modules/path/src/Hook/PathHooks.php, line 83

Class

PathHooks
Hook implementations for path.

Namespace

Drupal\path\Hook

Code

public function entityBaseFieldInfoAlter(&$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,
            ],
        ]);
    }
}

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