Skip to content
Snippets Groups Projects

Conditional default value for label

Files
2
@@ -76,8 +76,9 @@ public function form(array $form, FormStateInterface $form_state) {
'#type' => 'textfield',
'#title' => $this->t('Label'),
'#description' => $this->t('The label for this search page.'),
'#default_value' => $this->entity->label(),
'#default_value' => !$this->entity->isNew() ? $this->entity->label() : '',
'#maxlength' => '255',
'#required' => TRUE,
];
$form['id'] = [
Loading