public function CslStyleForm::form in Bibliography & Citation 8
Same name and namespace in other branches
- 2.0.x src/Form/CslStyleForm.php \Drupal\bibcite\Form\CslStyleForm::form()
Gets the actual form array to be built.
Overrides EntityForm::form
See also
\Drupal\Core\Entity\EntityForm::processForm()
\Drupal\Core\Entity\EntityForm::afterBuild()
1 call to CslStyleForm::form()
- CslStyleFileForm::form in src/
Form/ CslStyleFileForm.php - Gets the actual form array to be built.
1 method overrides CslStyleForm::form()
- CslStyleFileForm::form in src/
Form/ CslStyleFileForm.php - Gets the actual form array to be built.
File
- src/
Form/ CslStyleForm.php, line 18
Class
- CslStyleForm
- Add/edit form for bibcite_csl_style entity.
Namespace
Drupal\bibcite\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
/** @var \Drupal\bibcite\Entity\CslStyleInterface $csl_style */
$csl_style = $this
->getEntity();
$form['label'] = [
'#type' => 'textfield',
'#title' => $this
->t('Label'),
'#maxlength' => 255,
'#default_value' => $csl_style
->label(),
'#description' => $this
->t("Label for the CSL style."),
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $csl_style
->id(),
'#machine_name' => [
'exists' => [
CslStyle::class,
'load',
],
],
'#disabled' => !$csl_style
->isNew(),
];
$form['status'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enabled'),
'#default_value' => $csl_style
->status(),
'#access' => !$csl_style
->isNew(),
];
$form['csl'] = [
'#type' => 'textarea',
'#rows' => 20,
'#title' => $this
->t('CSL text'),
'#default_value' => $csl_style
->getCslText(),
'#required' => TRUE,
];
$form['url_id'] = [
'#type' => 'textfield',
'#title' => $this
->t('URL'),
'#access' => !$csl_style
->isNew(),
'#default_value' => $csl_style
->getUrlId(),
'#disabled' => TRUE,
];
$form['parent'] = [
'#type' => 'entity_autocomplete',
'#title' => $this
->t('Parent style'),
'#target_type' => 'bibcite_csl_style',
'#default_value' => $csl_style
->getParent(),
'#access' => !$csl_style
->isNew(),
'#disabled' => TRUE,
];
return $form;
}