I would like to had a field link in a custom block. Here is my code to do that :
public function blockForm($form, FormStateInterface $form_state) {
$form['key_1'] = [
'#title' => $this->t('Key 1 label'),
'#type' => 'textfield',
'#default_value' => '',
'#required' => false,
];
$form['key_2'] = [
'#title' => $this->t('key 2 link'),
'#type' => 'link',
];
return $form;
} Now, when I go in admin/structure/block/manage/myblock, I can see my key 1 field. The key 2 is not render. If I change the type for any other (textfield, textarea, file_managed) my field is properly render. The default link module is enabled.
Is the link field type only usable in node form ? I can understand why.