public function CertificateEntityForm::buildForm in Certificate 4.x
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides EntityForm::buildForm
File
- src/
Form/ CertificateEntityForm.php, line 14
Class
- CertificateEntityForm
- Form for certificate template.
Namespace
Drupal\certificate\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
$form['name']['widget'][0]['value']['#type'] = 'machine_name';
$form['name']['widget'][0]['value']['#machine_name'] = [
'source' => [
'title',
'widget',
'0',
'value',
],
'exists' => [
$this,
'exists',
],
];
// Add the token tree UI.
$form['token_help'] = [
'#theme' => 'token_tree_link',
'#token_types' => array_merge([
'user',
], certificate_get_entity_types()),
'#global_types' => FALSE,
];
return $form;
}